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 >>
Post Reply
Posts: 2
Joined: Tue May 11, 2021 6:56 am

Predict after runmlwin

Post by GeorgeSteven »


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.
Posts: 1285
Joined: Mon Oct 19, 2009 10:34 am

Re: Predict after runmlwin

Post by ChrisCharlton »

I think that you have an extra comma that shouldn't be there in the:

Code: Select all

level2(Period:cons, , residuals(v))
part of your syntax. Otherwise what you wrote should work. See chapter 3 of the MLwiN manual replication materials on ... /examples/ for an example.
Post Reply