Page 1 of 1

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

Posted: Tue Jun 25, 2019 2:18 pm
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 1946 times
), I realy wish to know why is that. Is there anyone know why there is a difference among these three ways?

Many thanks.

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

Posted: Wed Jun 26, 2019 10:20 am
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.

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

Posted: Wed Jun 26, 2019 9:00 pm
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.

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

Posted: Thu Nov 28, 2019 5:06 am
by NathanielDees
tahanks for help.