I estimate a logit model and then I need to calculate Prob[Y=1|X], where X is my set of regressors. Obviously, I can use:
Code:
predict probabilities
Code:
webuse auto.dta, replace gen dummy=0 replace dummy=1 if price>9500 rename logit dummy logit dummy mpg trunk length gen probabilities2=1/(1+exp(-(_b[mpg]*mpg+_b[trunk]*trunk+_b[length]*length+_b[_cons]*_cons)))
Code:
logit dummy mpg trunk length matrix bmatrix=e(b) mat accum m = mpg trunk length matrix xb=bmatrix*m gen probabilities=1/(1+exp(-(xb)))
[CODE}
matrix operators that return matrices not allowed in this context
[/CODE]
How can I include the generated values xb?
Thanks in advance for your help.
Dario
0 Response to Manually producing probabilites after logit
Post a Comment