Results different in MLwiN and R (R2MLwiN/lme4) for a 5-level variance components model

Welcome to the forum for R2MLwiN users. Feel free to post your question about R2MLwiN 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 R2MLwiN: Running MLwiN from within R >> http://www.bris.ac.uk/cmm/software/r2mlwin/
Post Reply
binchi19
Posts: 2
Joined: Wed Oct 17, 2018 1:32 pm

Results different in MLwiN and R (R2MLwiN/lme4) for a 5-level variance components model

Post by binchi19 »

Hi,

I run a five-level variance components models in R and MlwiN with the same data, In R I tried to run the model using two different packages; one is R2MLwiN, the other the lme4. But all these results are different. when I used Lme4 the results shows " Model failed to converge with max|grad| = 0.00206026 (tol = 0.002, component 1)". But the model works well in MlwiN or by R2MLwiN in R. What is more, these three results are different(
differents.docx
(173.88 KiB) Downloaded 1937 times
), I realy wish to know why is that. Is there anyone know why there is a difference among these three ways?

Many thanks.
ChrisCharlton
Posts: 1348
Joined: Mon Oct 19, 2009 10:34 am

Re: Results different in MLwiN and R (R2MLwiN/lme4) for a 5-level variance components model

Post by ChrisCharlton »

As R2MLwiN is just calling MLwiN you should get the same answers between the two packages. This suggests that either the model specification or the data are different between the two model runs. It may just be that the data is sorted incorrectly, as there is a bug in some versions of R2MLwiN prior to 0.8-6 where the check for this was not been applied correctly. To check this I would suggest running R2MLwiN in debug mode, i.e. by changing your call to the following:

Code: Select all

VarCompModel <- runMLwiN(Formula = F1, data = tran200912, estoptions=list(debugmode=TRUE))
This will open the MLwiN GUI where you can check that the model looks correct via the Model->Equations window, the data is sorted correctly via the Model->Hierarchy information window and that the data looks correct via the Data Manipulation->Names window.
binchi19
Posts: 2
Joined: Wed Oct 17, 2018 1:32 pm

Re: Results different in MLwiN and R (R2MLwiN/lme4) for a 5-level variance components model

Post by binchi19 »

I just had a new problem of R2MLwiN, the code works well in the daytime today but it suddenly did not work tonight. The warning is shown below. Can I ask why?


> sort2009 <- tran200912[with(tran200912, order(gorid,lauaid,msoaid,lsoaid,tran2009id)),]
> F2009 <- priceper ~ 1+(1| gorid)+(1 |lauaid)+(1 |msoaid)+(1|lsoaid)+(1|tran2009id)
> model2009 <- runMLwiN(Formula = F2009, data =sort2009,estoptions = list(resi.store = TRUE) )
Error in tapply(seq_len(455991L), list(lsoaid = c(1L, 1L, 1L, 1L, 1L, :
total number of levels >= 2^31



Many thanks.
NathanielDees
Posts: 1
Joined: Thu Nov 28, 2019 5:05 am

Re: Results different in MLwiN and R (R2MLwiN/lme4) for a 5-level variance components model

Post by NathanielDees »

tahanks for help.
Post Reply