Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, is already up and running.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: predict

From   Maarten Buis <>
Subject   Re: st: predict
Date   Mon, 6 Jun 2011 12:30:54 +0200

On Mon, Jun 6, 2011 at 10:55 AM, Chiara Mussida <> 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
*   For searches and help try:

© Copyright 1996–2015 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index