[R-sig-ME] correlation of random factors in mixed models

Ken Beath ken.beath at mq.edu.au
Tue Oct 7 11:28:57 CEST 2014


The correlation of the random effects comes from the model, that is it is
estimated from the data using maximum likelihood. The ranef are obtained as
predictions for each subject based on their observed data and the
distribution of the random effect. I think it is optimistic to expect that
you would end up with the same correlations  given that there is a fair
amount of error in the ranef predictions. Trying with simulated data for a
very large number of groups they should be similar.

With a random intercept slope model the random effects will almost always
be correlated, so it is always a good idea to include the correlation. You
can change the correlation simply by taking a linear transform of the
observations, for example just change the Days to Days2 by subtracting 5
and fit a model with that. Then you will have much higher correlation. All
it means is that higher values of slope random effect are associated with
higher values of intercept random effect.

You can have models where the random effects are not correlated, but I
think it is something that should be checked not assumed.

I don't know what is happening with the correlation of the fixed effects
and the lmList. It may be just spurious or their is something geometric
happening. I expect it wouldn't happen if the number of observations per
subject varied.

Ken



On 7 October 2014 03:32, Luis Cayuela Delgado <luis.cayuela at urjc.es> wrote:

> Dear list,
>
>
> I have three related questions about how to interpret the output of a
> mixed model. First, I am interested in understanding what is the meaning of
> the correlation for random factors. For example:
>
>
> library(lme4)
>
> mod0 <- lmer(Reaction ~ Days + (Days|Subject), data = sleepstudy)
>
> summary(mod0)
>
>
> This gives a correlation for random effects of 0.07. From other posts in
> the list I understood that this was the correlation between the random
> intercepts and the random slopes, so it should be calculated as:
>
>
> ran0 <- ranef(mod0)
>
> ran0
>
> cor(ran0$Subject[,1], ran0$Subject[,2])
>
>
>
> But this gives a correlation of 0.26. So how is the correlation for random
> effects estimated?
>
>
> Second, in case this correlation was high, what implications this might
> have? I have learned that the model could be refitted removing the
> correlation between random intercept and slope by specifying the model as
> follows:
>
>
> mod1 <- lmer(Reaction ~ Days + (1|Subject) + (0 + Days|Subject), data =
> sleepstudy)
>
> summary(mod1)
>
>
> When it is advisable to do this? If correlation of random effects was such
> a major issue, shouldn't we always fit the model as 'mod1'?
>
>
> And then a final question, I have seen that when specifying the model as
> 'mod1', the correlation of fixed effects change. I don't get this, since
> correlation of fixed effects -as far as I understood- is calculated from
> the estimated parameters of independent linear models for each of the
> levels of the random factor. So for the above-mentioned example:
>
>
> a <- lmList(Reaction ~ Days | Subject, sleepstudy)
>
> cor(coef(a)[,1], coef(a)[,2])
>
>
> This results in a correlation coefficient of -0.138, which matches the
> correlation for fixed effects in 'mod0'. So where does the correlation for
> fixed effects in 'mod1' (r = -0.184) come from?
>
>
> Sorry for such a long post and hope that the questions are interesting for
> some other list useRs.
>
>
> I am working with R 3.1.0. under Ubuntu Saucy 13.10, with package 'nlme'
> version 3.1.117 and package 'lme4' version 1.1.-7.
>
>
> Thanks in advance,
>
>
> Luis Cayuela
>
> Universidad Rey Juan Carlos
>
> Spain
>
>
>         [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-mixed-models at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>



-- 

*Ken Beath*
Lecturer
Statistics Department
MACQUARIE UNIVERSITY NSW 2109, Australia

Phone: +61 (0)2 9850 8516

Building E4A, room 526
http://stat.mq.edu.au/our_staff/staff_-_alphabetical/staff/beath,_ken/

CRICOS Provider No 00002J
This message is intended for the addressee named and may...{{dropped:9}}



More information about the R-sig-mixed-models mailing list