Bug in residuals(u, savechains("u.dta", replace")) ?

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
ash
Posts: 6
Joined: Wed Jul 13, 2011 7:38 pm

Bug in residuals(u, savechains("u.dta", replace")) ?

Post by ash »

hi-

I'm estimating a multivariate cross-classified model with mcmc. I aim to save the residual chains using:
...
level3(id: (cons B , eq(1))(cons B, eq(2)) (cons B, eq(3)), residuals(u, savechains("u.dta", replace)) ) ///
...

However when i examine "u.dta" after it has alot of missing data. Iteration, residual and idnum are there for all rows (28.86 million rows in this case - 575MB filesize). But the 'value' column is missing from precisely the 2500 iteration onward. Also, the "id" column is missing from the middle of the 723rd iteration.

The model didn't converge but it has very reasonable values for all parameters with healthy ESS and short but acceptable traces.

At a loss for what could cause this unexpected behaviour.

regards, ash
ash
Posts: 6
Joined: Wed Jul 13, 2011 7:38 pm

Re: Bug in residuals(u, savechains("u.dta", replace")) ?

Post by ash »

i think i'm on the source of the bug. In the "u.dta" file the idnum iterates up to the number of level 2 units BUT i specified i want level3 residuals.

fyi. i tried the same model in univariate and bivariate version and with thinning. The univariate residuals are correct while the bivariate and thinned multivariate residual are incorrect. Could runmlwin be using the wrong number of units to split the residual column into unit components? Perhaps this only occurs in Multivariate & Cross-classified models.

regards, a
GeorgeLeckie
Site Admin
Posts: 432
Joined: Fri Apr 01, 2011 2:14 pm

Re: Bug in residuals(u, savechains("u.dta", replace")) ?

Post by GeorgeLeckie »

Hi Ash,

I suspect the problem is associated with the fact that an N level multivariate response model is formulated as a N+1 level model in MLwiN where the lowest level is a pseudo level. (There are no random effects at this level, it exists solely to define the structure of the multivariate response. You can see this if you click on resp in the MLwiN equations window (don't use the nopause option and runmlwin will leave the MLwiN equations window open for you). The lowest level will say resp_indicator, this is the pseudo level.)

Now in our runmlwin syntax, if you want an N level multivariate response model you simply specify an N level multivariate response model in the way that you have done and runmlwin will know to set this up with the pseudo level in MLwiN.

So when you requested level 3 residuals using runmlwin it should go and find the level 4 residuals in the MLwiN model (due to the presence of the pseudo level). However, instead it looks like we have mistakenly told runmlwin to go and look for the level 3 residuals in the MLwiN model. That is, it looks like we are mistakenly looking at the residuals one level lower than the actual level of interest.

We will look into this and get back to you

Many thanks

George
ash
Posts: 6
Joined: Wed Jul 13, 2011 7:38 pm

Re: Bug in residuals(u, savechains("u.dta", replace")) ?

Post by ash »

yes that makes sense. it occurred to me to try putting in a meaningless higher level to try out the theory.

please do keep me posted. my efforts are somewhat crippled in the meantime.

many thanks, ash
GeorgeLeckie
Site Admin
Posts: 432
Joined: Fri Apr 01, 2011 2:14 pm

Re: Bug in residuals(u, savechains("u.dta", replace")) ?

Post by GeorgeLeckie »

Dear Ash,

The cause of the problem you found was the one that we thought it might be (described in the earlier post).

We have now fixed this bug.

Please update your version of runmlwin, by typing the following in Stata

adoupdate runmlwin

Many thanks for pointing this problem out to us

George
Post Reply