Hi,
I find runmlwin is not compatible with command "margins".
So, I fit a multinominal model and then calculate probabilities by hand using the expression like:
"Pr(y = 1) = " exp([FP1]cons_1)/ ///
(1 + exp([FP1]cons_1) + exp([FP2]cons_2) + exp([FP3]cons_3))"
But I am not sure the correct way to calculate 95% CI of the predicted probability. Does anyone know this? Thank you!
Best wishes,
Rodrigo
predict probability and CI

 Site Admin
 Posts: 428
 Joined: Fri Apr 01, 2011 2:14 pm
Re: predict probability and CI
Hi Rodrigo,
That is correct runmlwin is not comaptabile with margins.
However, you should be able to do what you want simply by using the nlcom command to calculate the expression you have written out.
Best wishes
George
That is correct runmlwin is not comaptabile with margins.
However, you should be able to do what you want simply by using the nlcom command to calculate the expression you have written out.
Best wishes
George
Re: predict probability and CI
Hi George,
Thank you for your kind reply. I have calculated the probabilities for each response of the multinominal model by hand. But I need 95% CI of prediction, and hence have to calculate standard error of prediction by hand as well (I am not sure the stata command predict se, stdp can work in this circumstance). I didn't find such examples in MLwin User Manual. Could you give me advice how to get standard error of prediction of the multinominal model?
Thanks
Rodrigo
Thank you for your kind reply. I have calculated the probabilities for each response of the multinominal model by hand. But I need 95% CI of prediction, and hence have to calculate standard error of prediction by hand as well (I am not sure the stata command predict se, stdp can work in this circumstance). I didn't find such examples in MLwin User Manual. Could you give me advice how to get standard error of prediction of the multinominal model?
Thanks
Rodrigo
Re: predict probability and CI
Hi George,
I just manage to get s.e. just by copying or replacing original vars with a set of vars_1 and vars_2 which the stata recognises. The commands are like these (response 0: reference; response 1: oc; response 2: ic):
The predicted ocxb and icxb are exactly the same as I calculated by hand. The two probabilities are thus calculated like
I can also calculate lower and upper bounds of linear prediction
So far so good. However, I don't know if calculating CIs is as straightforward as probabilities, because it involves lower and upper bounds of both oc and ic. I
Are the following expressions for calculating lower and upper bounds of the probabilities of oc correct?
Thank you
Rodrigo
I just manage to get s.e. just by copying or replacing original vars with a set of vars_1 and vars_2 which the stata recognises. The commands are like these (response 0: reference; response 1: oc; response 2: ic):
Code: Select all
predict ocxb, outcome(FP1) xb
predict ocse, outcome(FP1) stdp
predict icxb, outcome(FP2) xb
predict icse, outcome(FP2) stdp
Code: Select all
gen prob_oc = exp(ocxb)/(1+exp(ocxb)+exp(icxb))
gen prob_ic = exp(icxb)/(1+exp(ocxb)+exp(icxb))
Code: Select all
gen oclb = ocxb  1.96*ocse
gen ocub = ocxb + 1.96*ocse
gen iclb = icxb  1.96*icse
gen icub = icxb + 1.96*icse
Are the following expressions for calculating lower and upper bounds of the probabilities of oc correct?
Code: Select all
gen oclbp = exp(oclb)/(1+exp(oclb)+exp(iclb))
gen ocubp = exp(ocub)/(1+exp(ocub)+exp(icub))
Rodrigo