Hello!
I am estimating multinomial logistic regression using mi estimate: mlogit. I need to get predicted probabilities for all outcome categories.
For example, if I use regular dataset without multiple imputations I would do this (I used simulated data):
This will give me predicted probabilities for each of the outcome categories. However, I cannot do the same with mi data.
My code is:
This gives me a constant probability for category 4 (0.5), which is because the linear prediction for this category is 0 (since it is base outcome). Is there any way to do something similar that predict command after mlogit do in the regular settings?
Thank you in advance!
I am estimating multinomial logistic regression using mi estimate: mlogit. I need to get predicted probabilities for all outcome categories.
For example, if I use regular dataset without multiple imputations I would do this (I used simulated data):
Code:
clear all set obs 1000 g x1 = invnorm(runiform()) g x2 = invnorm(runiform()) g x3 = invnorm(runiform()) gen byte y=1 forval i=1/3 { replace y=y+1 if runiform()<.3+.1*x1+.2*x2-.3*(!x3) } tab y foreach var of varlist x1-x3 { replace `var' = . if runiform()<.2 } mlogit y x1 x2 x3 predict pr1 pr2 pr3 pr4, pr
My code is:
Code:
mi set flong mi reg imp x1 x2 x3 mi impute chained (pmm, knn(10)) x1 x2 x3 = y, add(10) mi estimate, saving(simulation.ster, replace): mlogit y x1 x2 x3 mi predict nxb1 using simulation.ster, storecompleted equation(#1) mi predict nxb2 using simulation.ster, storecompleted equation(#2) mi predict nxb3 using simulation.ster, storecompleted equation(#3) mi predict nxb4 using simulation.ster, storecompleted equation(#4) sum nxb* mi xeq: generate nps1 = invlogit(nxb1) mi xeq: generate nps2 = invlogit(nxb2) mi xeq: generate nps3 = invlogit(nxb3) mi xeq: generate nps4 = invlogit(nxb4) sum nps*
Thank you in advance!
Comment