Hi,
I want to change some of the RHS variables in -mlogit-, then
re-calculate the probability for a certain outcome with the
original coefficients. I would like to do this to to compare
the predicted probabilitites from the base estimation with
probabilities resulting from the prediction with changed RHS
variables.
-----start-------
** here we go, base estimation & prediction:
. local vars00 "d f g h j k"
. mlogit lu00 `vars00', robust b(3) cl(v00acs) nolo
<output supressed>
. tokenize `vars00'
. gen
ypb_d1=exp([1]_b[_cons]+[1]_b[`1']+[1]_b[`2']+[1]_b[`3']+[1]
_b[`4'])
. gen
ypb_n2=exp([2]_b[_cons]+[2]_b[`1']+[2]_b[`2']+[2]_b[`3']+[2]
_b[`4'])
. gen
ypb_n3=exp([3]_b[_cons]+[3]_b[`1']+[3]_b[`2']+[3]_b[`3']+[3]
_b[`4'])
. ** base prob for outcome 1 (should be same as in -predict
p00_1, outcome(1)- :
. gen ypb=ypb_d1/(ypb_n2+ypb_n3)
. su yp*
Variable | Obs Mean Std. Dev. Min
Max
-------------+----------------------------------------------
-------
ypb_d1 | 22291 11.4102 0 11.4102
11.4102
ypb_n2 | 22291 4730.779 0 4730.779
4730.779
ypb_n3 | 22291 1 0 1
1
ypb | 22291 .0024114 0 .0024114
.0024114
-----end-------
Obviously, the result is crap. And here my questions:
1. What is wrong in the above code and gives me wrong
predictions?
2. The 'real' data has more categories and many more
variables. Is there a less error-prone and shorter way to
write above code?
For any hints, I would be very very grateful,
greetings,
--- Daniel ---
[email protected]
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/