Page 1 of 1

Multiple membership model error

Posted: Mon Apr 14, 2014 8:03 am
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

Re: Multiple membership model error

Posted: Thu Apr 17, 2014 2:50 pm
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

Re: Multiple membership model error

Posted: Wed Apr 23, 2014 12:41 pm
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

Re: Multiple membership model error

Posted: Wed Apr 23, 2014 2:15 pm
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

Re: Multiple membership model error

Posted: Thu Apr 24, 2014 10:08 am
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