Skip to content

same model runs in nlme but not lme4

8 messages · Simon Harmel, Ben Bolker

#
Hi All,

I was wondering why my model runs ok when I use `nlme` package but it fails
when I use the `lme4` package, am I missing something?

Thanks, Simon

#===================================
library(lme4)
library(nlme)

dat <- read.csv('https://raw.githubusercontent.com/hkil/m/master/z.csv')

m1 <- lmer(y~ group*year + (year|stid), data = dat)       ## Fails ###

m2 <- lme(y~ group*year, random = ~year|stid, data = dat) ## Runs ###
#
? Because lme4 is fussier than lme.? lme will fit models where the 
variance components are jointly unidentifiable; lmer tries to detect 
these problems and complains about them.? It's possible that this is a 
false positive.? You can make it run by specifying

m1 <- lmer(y~ group*year + (year|stid), data = dat, 
control=lmerControl(check.nobs.vs.nRE="ignore"))

 ? but I strongly recommend that you think about whether this might be 
exposing problems.

 ?calculating the profile suggests a little bit of weirdness.

pp <- profile(m1,signames=FALSE)

dd <- as.data.frame(pp)

library(ggplot2)
ggplot(dd,aes(.focal,.zeta)) + geom_point() + geom_line() + 
facet_wrap(~.par,scale="free_x")

You can compare confint(pp) to intervals(m2); they're mostly consistent, 
but some caution is suggested for the CIs on the correlation and the year SD
On 5/22/20 5:57 PM, Simon Harmel wrote:
#
Many thanks, Ben. Just curious, what information do the plots at the end of
your exactly convey?

I also appreciate it if there if you could point me to a documentation in
lme4 where I can learn more about `profile()` and its output.

Many thanks, Simon
On Fri, May 22, 2020 at 5:25 PM Ben Bolker <bbolker at gmail.com> wrote:

            

  
  
#
?? Profile plots expressed in terms of the signed square root are 
straight lines if the log-likelihood surface is quadratic (in which case 
the Wald confidence intervals will be reliable). (I know that's very 
terse but I'm composing in haste.)

 ? vignette("lmer", package="lme4") has a little bit.? More generally 
you can read in any advanced stats book about likelihood profiles and 
what they are/mean (section 4 of 
https://ms.mcmaster.ca/~bolker/emdbook/chap6A.pdf gives one such 
introduction).
On 5/22/20 6:35 PM, Simon Harmel wrote:

  
  
#
Short but very clear. Appreciate it very much. Don't mean to make this
long, but how this likelihood profile analysis relates with fitted vs.
residual relation? Can they be at odds?
On Fri, May 22, 2020 at 5:41 PM Ben Bolker <bbolker at gmail.com> wrote:

            

  
  
#
?? They're pretty separate things.? The? likelihood profile is 
completely conditional on the model.? I suppose if the data are 
completely insane then the profile will probably be weird too. The 
profile has to do with the shape of the likelihood surface rather than 
the distribution of the variation around the model.
On 5/22/20 7:24 PM, Simon Harmel wrote:

  
  
#
Many thanks!
On Fri, May 22, 2020 at 6:35 PM Ben Bolker <bbolker at gmail.com> wrote:

            

  
  
#
Just curious, *as.data.frame(profile(fitted glmmTMB model))* e.g., as
demonstrated HERE
<https://rdrr.io/cran/glmmTMB/man/profile.glmmTMB.html>, doesn't
return a "zeta" column as in lme4 models, rather it contains a column
called "value", what is "value" and why we take its square root when
plotting the likelihood profile?

(p.s. I'm assuming a V pattern in the likelihood profile plot would confirm
the health of Wald CIs for glmTMB models, right?)

Thanks, Simon
On Fri, May 22, 2020 at 6:42 PM Simon Harmel <sim.harmel at gmail.com> wrote: