PRJConditional - predicted probs for a conditional logit

Use this forum to post complete RATS "procedures". Please be sure to include instructions on using the procedure and detailed references where applicable.

PRJConditional - predicted probs for a conditional logit

Postby TomDoan » Thu Jul 10, 2008 1:58 pm

This computes the predicted probabilities for a conditional logit model for an input collection of attributes for the choices.


Code: Select all
*
* @PRJConditional( options )
* computes predicted probabilities for a conditional logit.
* This should be only be used after doing DDV with TYPE=CONDITIONAL.
*
* Options:
*  ATTRIBUTES=RECTANGULAR of attributes for the choices being examined. This should
*    be a choices x regressors array, where each row has the attributes for one
*    choice.
*  LABELS=VECTOR[STRINGS] with labels for the choices.
*  TITLE=title for output
*
* Revision Schedule:
*  07/2008 Written by Tom Doan, Estima.
*
procedure PRJConditional
option rect          attributes
option vect[strings] labels
option string        title
*
local vector z p
*
compute z=attributes*%beta
compute p=%exp(z)/%sum(%exp(z))
report(action=define)
if %defined(title)
   report(atrow=1,atcol=1,span) title
else
   report(atrow=1,atcol=1,span) "Predicted Probabilities"
do i=1,%rows(z)
   if %defined(labels)
      report(atrow=i+1,atcol=1) labels(i) p(i)
   else
      report(atrow=i+1,atcol=1) "Choice "+i p(i)
end do i
report(action=format,picture="*.####")
report(action=show)
end
TomDoan
 
Posts: 2720
Joined: Wed Nov 01, 2006 5:36 pm

Return to RATS Procedures

Who is online

Users browsing this forum: No registered users and 0 guests