[R] random effects correlation in lmer
Daniel Malter
daniel at umd.edu
Tue Nov 24 21:17:08 CET 2009
It implies that the random intercept is perfectly collinear with the random
slope, as you suggested. I attach an example.
The data generating process of y1 has a random intercept, but no random
slope. When you fit a model with random intercept and random slope, the
correlation between the two is estimated at -1. However, note that the
variance of the random slope is almost zero. Thus, we fit the wrong model. A
random intercept only model would have sufficed.
The data generating process of y2 includes a random slope, but those with
the higher intercepts also have the greater slopes. Random intercept and
random slope estimates are perfectly collinear. This leads to the problem
you encounter. Models 2a and 2b provide random intercept only and random
slope only estimates for comparison. It would suffice in this case to fit a
random intercept model.
Finally, the data generating process for y3 has random intercept and slope,
but both are independent, so that the problem does not occur.
library(lme4)
tim=rep(10:19,10)
id=rep(1:10,each=10)
rand.int=rep(rnorm(10,0,1),each=10)
rand.slop=rep(rnorm(10,0,1),each=10)
e=rnorm(100,0,0.5)
y1=10+rand.int+tim+e
y2=10+rand.int+tim+e
y3=10+rand.int+tim+rand.slop*tim+e
reg1=lmer(y1~tim+(tim|id))
summary(reg1)
reg2=lmer(y2~tim+(tim|id))
summary(reg2)
reg2a=lmer(y2~tim+(1|id))
summary(reg2a)
reg2b=lmer(y2~tim+(-1+tim|id))
summary(reg2b)
reg3=lmer(y3~tim+(tim|id))
summary(reg3)
HTH,
Daniel
Kurt Smith-3 wrote:
>
> I am having an issue with lmer that I wonder if someone could explain.
>
> I am trying to fit a mixed effects model to a set of longitudinal data
> over a set of individual subjects:
> (fm1 <- lmer(x ~ time + (time|ID),aa))
>
>
> I quite often find that the correlation between the random effects is 1.0:
> Linear mixed model fit by REML
> Formula: x ~ time + (time | ID)
> Data: aa
> AIC BIC logLik deviance REMLdev
> 28574 28611 -14281 28561 28562
> Random effects:
> Groups Name Variance Std.Dev. Corr
> ID (Intercept) 77.035 8.7770
> time 10.817 3.2889 1.000
> Residual 112.151 10.5901
> Number of obs: 3539, groups: ID, 1000
>
> Fixed effects:
> Estimate Std. Error t value
> (Intercept) 98.7601 0.3894 253.64
> time 1.3671 0.2001 6.83
>
> Correlation of Fixed Effects:
> (Intr)
> time -0.045
>
>
> All other parameters seem to converge as I increase the size of the
> data set, or have a reasonable distribution over several bootstrap
> samples. This suggests to me there is a singularity or something in
> solving for the random effects correlation. Does anyone have any
> insight?
> Thanks,
> Kurt Smith
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
>
--
View this message in context: http://old.nabble.com/random-effects-correlation-in-lmer-tp26489187p26501151.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list