Dear All,

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
after the logit estimation. However, for some specific reasons I need to compute those probabilities "manually". Hence, I have:

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)))
The above will give me the same results, as if I use the postestimation command predict probabilities. However, rather then writing down the full list of estimated parameters and regressors, I would like to find out a short way. My attempt was:

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)))
My doubts: 1) is the way I tried to generate xb correct? I am not sure about it. If not, how I can modify the calculation? 2) When I enter xb in the last line, I get the error message:

[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