Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: st: predict
From
Maarten Buis <[email protected]>
To
[email protected]
Subject
Re: st: predict
Date
Mon, 6 Jun 2011 12:30:54 +0200
On Mon, Jun 6, 2011 at 10:55 AM, Chiara Mussida <[email protected]> wrote:
> Likely there is a way to automatically compute predicted prob in STATA
> (alternative to predict) to get:
You should not do this manually, the chance of making an error is just too big.
However, if you are brave/foolish enough to try, than you can do so,
and if you do not make an error you will get exactly the same results
as -predict-:
*------------------------ begin example ------------------------
sysuse auto, clear
recode rep78 1/2=3
mlogit rep78 foreign
predict double pr*, pr
gen double xb1 = _b[4:_cons] + _b[4:foreign]*foreign
gen double xb2 = _b[5:_cons] + _b[5:foreign]*foreign
gen double denom = 1 + exp(xb1) + exp(xb2)
gen double mp1 = 1/denom
gen double mp2 = exp(xb1)/denom
gen double mp3 = exp(xb2)/denom
tab pr1 mp1
tab pr2 mp2
tab pr3 mp3
*-------------------- end example ------------------------------
-- Maarten
--------------------------
Maarten L. Buis
Institut fuer Soziologie
Universitaet Tuebingen
Wilhelmstrasse 36
72074 Tuebingen
Germany
http://www.maartenbuis.nl
--------------------------
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/