Problem with 2nd-level variables in ordered multilevel model

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
giodje12
Posts: 8
Joined: Mon Aug 13, 2012 4:17 pm

Problem with 2nd-level variables in ordered multilevel model

Post by giodje12 »

Dear runmlwin user forum-Members,
I am trying to fit a two-level ordinal model, but I get problems when I insert the second level variables. I start just including level-one variables (relaxing the parallel assumption for some of them) and the following code runs smoothly.

runmlwin GPhelp_3cat cons female seventyPlus lowEd poorhealth (sixty notmarried midEd retired depression, contrast(1/2)), level2(country: (cons, contrast(1/2))) level1(mergeid) ///
discrete(distribution(multinomial) link(ologit) denominator(cons) basecategory(1)) nopause or
matrix b = e(b)
matrix V = e(V)
runmlwin GPhelp_3cat cons female seventyPlus lowEd poorhealth (sixty notmarried midEd retired depression, contrast(1/2)), level2(country: (cons, contrast(1/2))) level1(mergeid) ///
discrete(distribution(multinomial) link(ologit) denominator(cons) basecategory(1)) mcmc(chain(50000)) initsb(b) initsv(V) nopause or

However, when I also consider two extra variables at the country-level, I get stuck. And I’m not sure what is going on and how to fix this problem. I run the following code (with the additional two country-variables centered_childsuffer and centered_percentageWomenEmployed)

runmlwin GPhelp_3cat cons female seventyPlus lowEd poorhealth centered_childsuffer centered_percentageWomenEmployed (sixty notmarried midEd retired depression, contrast(1/2)),
level2(country: (cons, contrast(1/2))) level1(mergeid) ///
discrete(distribution(multinomial) link(ologit) denominator(cons) basecategory(1)) nopause or

I get the following error message
error while obeying batch file C:\Program Files\MLwiN v2.25\multicat\pre at line number 69: calc 'Pi'=1/(1+expo(-('H')))
1872 numeric errors in calculate command, first 20 affected entries listed. Affected entries replaced with system missing.
WARNING: macro file has aborted, your data may be in a transformed state

Could you please advice what this means and how to fix this?
I would very much appreciate your help and time!
Kind regards,
Giorgio
GeorgeLeckie
Site Admin
Posts: 432
Joined: Fri Apr 01, 2011 2:14 pm

Re: Problem with 2nd-level variables in ordered multilevel m

Post by GeorgeLeckie »

Hi,

It is not immediately apparent why you have run into numerical difficulties when you add the two country-level variables. The runmlwin syntax looks fine.One thing which you should do which might get you past the error message is to always build your models up sequentially using the parameter estimates from the previous model as starting values for the next model.

The best way to do this is to go

* Model 1 - MQL1
runmlwin,...
estimates store m1mql1

* Model 2 - MQL1
runmlwin,... initsmodel(m1mql1)
estimates store m2mql1

* Model 1 - MCMC
runmlwin,... initsmodel(m1mql1)


* Model 2 - MCMC
runmlwin,... initsmodel(m2mql1)


You might want to start by only adding one country level variable, then use the parameter estimates from this model as starting values for fitting the model additionally with the second country level variable.

Alternatively, you could try only relaxing the parallel regression assumption once you have fitted the model with the country-level covariates (currently you are going about the problem the other way around).

Centring and rescaling your continuous covariates so they are on similar scales may help

Checking that your country level covariates are not overly correlated would also be worth doing.

I hope this helps

George
giodje12
Posts: 8
Joined: Mon Aug 13, 2012 4:17 pm

Re: Problem with 2nd-level variables in ordered multilevel m

Post by giodje12 »

Dear George,
I very much appreciated your prompt reply.
I first fitted the model including one country-level variable at the time, without relaxing the parallel regression assumption.
Then I used the parameter estimates from this model as starting values for fitting the final model in which I relaxed the parallel line assumption for both the country-level and the person-level variables. This way I did not get any error messages.

thanks for your invaluable feedback.
Regards
Giorgio
Adcoenen
Posts: 2
Joined: Wed Sep 10, 2014 8:32 am

Re: Problem with 2nd-level variables in ordered multilevel m

Post by Adcoenen »

Dear George,

I am facing the same problem but am working in R. I have tried to find the recommended commands but couldn't find them.
Can you offer the commands for the same solution in R?

Thanks in advance,
Ad
richardparker
Posts: 61
Joined: Fri Oct 23, 2009 1:49 pm

Re: Problem with 2nd-level variables in ordered multilevel m

Post by richardparker »

Dear Ad,

For MCMC models estimated via R2MLwiN, starting values can be specified via the estoptions argument startval.

See, for example the demo for Chapter 5 of the MCMC manual - e.g. to run it:

Code: Select all

R> demo(Chapter05)
or return the script:

Code: Select all

R> file.show(system.file("demo", "Chapter05.R", package = "R2MLwiN"))
You could then, of course, either manually type in your starting values, or could specify them via e.g.

Code: Select all

mymodel@estMCMC[1, "_FP_b"]
. E.g. see str(mymodel) or slotNames(mymodel).

There currently isn't the facility to specify starting values for models fitted using IGLS via R2MLwiN, although there will be in an upcoming release (due late summer / early autumn), or you could build a copy from the development version of R2MLwiN on R-Forge if you're interested in trying it now (with the caveat it hasn't been fully tested).

Best wishes,

Richard
Adcoenen
Posts: 2
Joined: Wed Sep 10, 2014 8:32 am

Re: Problem with 2nd-level variables in ordered multilevel m

Post by Adcoenen »

Dear Richard,

Thank you.
I fear my skills aren't developed enough for the IGLS code, but I'll look into the MCMC code.

Kind Regards,
Ad
Post Reply