Dear runmlwin users,
I have recently switched from using gllamm to runmlwin to fit multinomial ordered logit models. Whilst I am able to fit a model with one random slope at level 2 using runmlwin, once I try to fit more than one random slope, I get error messages from MLwiN.
My code in stata is as follows:
. runmlwin ols_imprel constant (female age relgroupdum2 relgroupdum3 relgroupdum4, ///
> contrast(1/3)), ///
> level2(lacode2: constant relgroupdum2 relgroupdum3 relgroupdum4) ///
> level1(caseid) discrete(distribution(multinomial) ///
> link(ologit) denom(caseid) base(3) mql1)
The error I get in MLwiN appears in the 2nd pause when the macro is running and says:
"error while obeying batch file C:\Program Files (x86)\MLwiN\v2.25\multicat\ pre at line number 69: calc 'Pi'=1/1+expo(-('H'))).
2090 numeric errors in calculate command, first 20 affected entries listed. Affected entries replaced with system missing.. See output window for details."
I don't know what this error means or what I should do to correct it.
I hope someone can help.
Thanks very much in advance.
Meena
estimating multiple random slopes
-
- Site Admin
- Posts: 432
- Joined: Fri Apr 01, 2011 2:14 pm
Re: estimating multiple random slopes
Hi Meena,
First thing, you are fitting an ordered model so you should start by fitting a common set of random effects for your log-odds contrasts (currently you are fitting separte random effects for each log-odds contrast). See Section 11.4 of the MLwiN User Manuual.
So you need something like this
More generally, I think you want to build your model up sequentially starting from a simple model and graudually adding in covariates and random effects
The key thing is to use the parameter estimates from the previous model as the starting values for the next model. This helps to cut down on convergence problems.
So first fit a model with no random slopes
Then fit a model with random slopes, but where you use the parameter estimates from the previous model as starting values for the next model
estimates store model1
I hope this helps
George
First thing, you are fitting an ordered model so you should start by fitting a common set of random effects for your log-odds contrasts (currently you are fitting separte random effects for each log-odds contrast). See Section 11.4 of the MLwiN User Manuual.
So you need something like this
Code: Select all
. runmlwin ols_imprel constant (female age relgroupdum2 relgroupdum3 relgroupdum4, ///
contrast(1/3)), ///
level2(lacode2: (constant relgroupdum2 relgroupdum3 relgroupdum4, contrast(1/3))) ///
level1(caseid) discrete(distribution(multinomial) ///
link(ologit) denom(caseid) base(3) mql1) initsmodel(model1)
More generally, I think you want to build your model up sequentially starting from a simple model and graudually adding in covariates and random effects
The key thing is to use the parameter estimates from the previous model as the starting values for the next model. This helps to cut down on convergence problems.
So first fit a model with no random slopes
Code: Select all
. runmlwin ols_imprel constant (female age relgroupdum2 relgroupdum3 relgroupdum4, ///
contrast(1/3)), ///
level2(lacode2: (constant, contrast(1/3))) ///
level1(caseid) discrete(distribution(multinomial) ///
link(ologit) denom(caseid) base(3) mql1)
estimates store model1
Code: Select all
. runmlwin ols_imprel constant (female age relgroupdum2 relgroupdum3 relgroupdum4, ///
contrast(1/3)), ///
level2(lacode2: (constant relgroupdum2 relgroupdum3 relgroupdum4, contrast(1/3))) ///
level1(caseid) discrete(distribution(multinomial) ///
link(ologit) denom(caseid) base(3) mql1) initsmodel(model1)
George
-
- Posts: 4
- Joined: Tue Mar 06, 2012 2:06 pm
Re: estimating multiple random slopes
Thanks very much for your help George.
Yes, I'll take your model-building advice on board. I have only just switched to runmlwin from gllamm, specifically because it was taking much too long for random slope models to converge in gllamm. As such, I wasn't quite sure where the contrast code was supposed to go and thought I had put it in the right place. Omitting this code explains why my estimates are different when I run the same random intercept models in gllamm and in runmlwin!
Thanks also for the advice on storing estimates and running the next model based on the previous models - I will try this and hopefully that will help.
Meena
Yes, I'll take your model-building advice on board. I have only just switched to runmlwin from gllamm, specifically because it was taking much too long for random slope models to converge in gllamm. As such, I wasn't quite sure where the contrast code was supposed to go and thought I had put it in the right place. Omitting this code explains why my estimates are different when I run the same random intercept models in gllamm and in runmlwin!
Thanks also for the advice on storing estimates and running the next model based on the previous models - I will try this and hopefully that will help.
Meena