Multiple membership model error

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
migsanse
Posts: 15
Joined: Sat Apr 06, 2013 9:17 am

Multiple membership model error

Post by migsanse »

Hi,
I am trying to run a multiple membership model using runmlwin in Stata (linking to MLWin v 2.30). I have used the code provided in section 16.4 of the MLWin MCMC manual. The code runs fine until the last command, when I get the following error message in Stata:

“Number of variables in mmids2() must equal number of variables in mmweights2().;”

My dataset is a cohort of 1000 individuals, who belong to 4 different neighborhoods along their life (sams1-sams4). I have created mmweight variables for each time point. I think I have the same number of variables in both the sams and the weights. My Stata code is shown below:

Code: Select all

sort sams1 id
quietly runmlwin Qfunc43 cons, level2(sams1: cons) level1(id: cons) nopause
matrix b = e(b)
matrix V = e(V)
runmlwin Qfunc43 cons, level2(sams1: cons, mmids(sams1-sams4) mmweights(weight1-weight4)) level1(id:cons) mcmc(on) initsb(b) initsv(V) nopause
Any suggestion?
Regards,
Miguel
GeorgeLeckie
Site Admin
Posts: 432
Joined: Fri Apr 01, 2011 2:14 pm

Re: Multiple membership model error

Post by GeorgeLeckie »

Hi Miguel,

Might it be that there is some other variable lurking within the range of variables specified by sams1-sams4 or weight1-weight4? You can check this easily enough by issuing the following commands

Code: Select all

. summarize sams1-sams4
. summarize weight1-weight44
Both commands should summarize four variables each. If one or other of them summarize more or less variables then re-order your data appropriately.

Best wishes

George
migsanse
Posts: 15
Joined: Sat Apr 06, 2013 9:17 am

Re: Multiple membership model error

Post by migsanse »

Thanks, it worked. I have another query. In the same example, the software gives me this error:
"Error, the MM ID variable 4 for observation 2 is present but a zero MM weight has been specified for it"

Data are in compact form. I coded the weights as 0 when the person had been in the same neighborhood. Or should I recode the neighborhoods as 0?
For instance, in case n=1, N3 and N4 should be coded as 0? or there are other solution?

Id N1 N2 N3 N4 W1 W2 W3 W4
1 100 101 101 101 .25 .75 0 0
2 201 201 202 202 .5 0 .5 0
3 301 301 301 302 .75 0 0 .25

Thanks in advance.
Best regards,
Miguel
GeorgeLeckie
Site Admin
Posts: 432
Joined: Fri Apr 01, 2011 2:14 pm

Re: Multiple membership model error

Post by GeorgeLeckie »

Hi Miguel,

The data should look like this...

See the LEMMA training materials module on multiple membership models for further details

Best wishes

George

Id N1 N2 N3 N4 W1 W2 W3 W4
1 100 101 0 0 .25 .75 0 0
2 201 202 0 0 .5 .5 0 0
3 301 302 0 0 .75 .25 0 0
migsanse
Posts: 15
Joined: Sat Apr 06, 2013 9:17 am

Re: Multiple membership model error

Post by migsanse »

Thanks George. Sorry one more issue:
MLwiN gives me another error message: "error while obeying batch file C:\XXX at line number 90: MCMC 0 500 1 5.8 50 10 1 1 1 1 1 1"

I read in another post that it might be due to the starting values. Any suggestion how to solve this?

Regards,
Mguel
Post Reply