3
$\begingroup$

I am fitting a multilevel model on pooled country-waves, i.e., I ignore the time framework and use individuals nested in countries. However, I obtain different results fitting the starting simple model between lme and lmer

fit1 <- lmer(isei_r ~ fisei + (fisei | country), data = working_age, 
             REML = FALSE, na.action = na.omit) 
fit2 <- lme(isei_r ~ fisei, random = ~ fisei | country, data = working_age,
            method = "ML", na.action = na.omit) 

Specifically, the first fails to converge, while the second does not show any problem and it's identical to Stata outcome obtained with:

mixed isei_r fisei || country : fisei 

I was wondering why is this the case? What is the main difference of lmer() with respect lme() (and/or mixed in Stata framework)?

I add small extract of a simplified dataset with only the variables included here:

 structure(list(country = structure(c(1, 1, 6, 9, 10, 15, 15, 
 18, 21, 23, 23, 25, 25, 25, 27, 27, 28, 29, 31, 31), label = "Country", labels = c(AT = 1, 
BE = 2, BG = 3, CH = 4, CY = 5, CZ = 6, DE = 7, DK = 8, EE = 9, 
ES = 10, FI = 11, FR = 12, GB = 13, GR = 14, HR = 15, HU = 16, 
IE = 17, IL = 18, IS = 19, IT = 20, LT = 21, LU = 22, LV = 23, 
NL = 24, NO = 25, PL = 26, PT = 27, RO = 28, RU = 29, SE = 30, 
SI = 31, SK = 32, TR = 33, UA = 34), class = "haven_labelled"), 
fisei = structure(c(NA, 46, 55, 29, 70, 21, 69, 23, 16, 70, 
37, 29, 30, 34, 16, NA, 32, 32, 41, 34), format.stata = "%10.0g"), 
isei_r = structure(c(50.439998626709, 51, 69, 53.8300018310547, 
51, 43.1699981689453, 67.6999969482422, 25, 33.2000007629395, 
67.6999969482422, 25, 28.8299999237061, 27, 39, 16, NA, 69, 
NA, 55.7799987792969, 69), format.stata = "%9.0g"), essround = structure(c(1, 
2, 2, 4, 5, 4, 5, 4, 4, 3, 4, 3, 4, 5, 1, 2, 4, 3, 3, 4), label = "ESS round", format.stata = "%12.0g")), row.names = c(NA, 
-20L), class = c("tbl_df", "tbl", "data.frame"))
$\endgroup$
11
  • $\begingroup$ "fails to converge" may be a false positive. How do the estimates and log-likelihood compare across models? $\endgroup$
    – Ben Bolker
    Jun 18 '20 at 14:42
  • $\begingroup$ between lme() and mixed in Stata they are exactly the same using ML in lme(). The difference is in lmer() that fails to converge. It is -561073.3 for Stata/lme() and -561090.9 for lmer() $\endgroup$ Jun 18 '20 at 14:46
  • $\begingroup$ any chance you could share your data so we can see what's going on? $\endgroup$
    – Ben Bolker
    Jun 18 '20 at 15:17
  • $\begingroup$ I'm sorry, what do you mean by [mcve]? $\endgroup$ Jun 18 '20 at 15:22
  • 1
    $\begingroup$ See here: "You may have been told to include an MCVE – Minimal, Complete, and Verifiable examples is what they were referring to. MCVE was also the former name of the page you're reading now, occasionally misspelled as MVCE, before it was renamed to Minimal, Reproducible Example (sometimes called “reprex”, “min-reprex”, “repro” or just “example”). $\endgroup$
    – Ben Bolker
    Jun 18 '20 at 15:38
5
$\begingroup$

It is difficult to see what is going on without a reproducible example. Nonetheless, mixed models are, in general, complex models. And because of this reason, the algorithms used to find the maximum likelihood may some times have trouble converging. Also, note that lmer(), lme() and STATA use different optimization algorithms with different defaults. Hence, is some examples, such as yours, it can happen that one is successful but the other not. In the majority of these cases, tweaking the optimization controls in the algorithm that was unsuccessful resolves the problems. For lmer() in particular have a look in the GLMM FAQ and here.

$\endgroup$
1
  • $\begingroup$ Yes, indeed I was forcing Stata and lme() to use the same optimization procedure that leads to exact same results in terms of coefficients, std error and whatever. The only difference was with lmer() where I wasn't sure on how change the optimization. I will go through your useful material to check it out. Many thanks! $\endgroup$ Jun 18 '20 at 14:40
2
$\begingroup$

One reason things might look different across lmer() and mixed is that lmer() (and I think lme()) estimates the covariance between the random slope and random intercept by default. On the other hand, mixed does not. You need to specify it explicitly as such:

 mixed isei_r fisei || country : fisei , cov(unstructured)

See if adding this to your mixed results in estimates that are similar across programs and routines.

$\endgroup$
1
  • $\begingroup$ Yes, absolutely this is an issue. Indeed I set cov(unstructured) with mixed and it obtain exactly the same outcome as lme(). The only problem/difference is in lmer(), which I do not know why it is the case.... $\endgroup$ Jun 18 '20 at 20:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.