'predict' after runmlwin

Welcome to the forum for runmlwin users. Feel free to post your question about runmlwin here. The Centre for Multilevel Modelling take no responsibility for the accuracy of these posts, we are unable to monitor them closely. Do go ahead and post your question and thank you in advance if you find the time to post any answers!

Go to runmlwin: Running MLwiN from within Stata >> http://www.bristol.ac.uk/cmm/software/runmlwin/
Post Reply
Posts: 2
Joined: Mon May 10, 2021 5:26 pm

'predict' after runmlwin

Post by GeorgeStevens »

Hi Statalist,

I am running a cross classified model using runmlwin. Previously, I had used meqrlogit and then I used the following code to predict fixed and random effects and to graph them:

predict v0*, reffects
predict v0se*, reffects
predict probAll
predict pfx, xb

gen probPeriod = 1 /(1+exp(-1*(pfx + v01)))
gen probPrL = probPeriod-1.96*v0se1
gen probPrU = probPeriod+1.96*v0se1

collapse (mean) probP = probPeriod (semean) probPs = probPeriod, by(Period)
gen probPrL = probP-1.96*probPs
gen probPrU = probP+1.96*probPs

twoway (connected probP Period, mcolor(black) lcolor(black)) ///
(connected probPrL Period, mcolor(black) lcolor(black) lpattern(dash)) ///
(connected probPrU Period, mcolor(black) lcolor(black) lpattern(dash)), ///
ytitle(Predicted probability with 95% confidence band) xtitle(Period) xlabel(#3) legend(off)

In an attempt to predict and graph my results using runmlwin I tried the following code:

runmlwin ID cons, level2(Period:cons, , residuals(v)) level1(Cohort: cons, residuals(u)) discrete(dist(binomial) link(logit) denom(denom)) mcmc(cc) initsprevious nopause
which returns error: invalid ’residuals’

Would anyone be able to provide any insight into how to calculate this when using the runmlwin package? Thanks.
Post Reply