Page 1 of 1

Predict after runmlwin

Posted: Tue May 11, 2021 7:11 am
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.

Re: Predict after runmlwin

Posted: Tue May 11, 2021 5:29 pm
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.