Correlation of random effects
On Wed, Aug 4, 2010 at 2:23 AM, David Duffy <davidD at qimr.edu.au> wrote:
On Tue, 3 Aug 2010, Gustavo Betini wrote:
m1<-lmer(pc1 ~ year + datejc + stage + rept + age + tarsusc + mtempc + windsc + rhc + (1|id), data=ndf, REML=0) m2<-lmer(pc1 ~ year + datejc + stage + rept + age + tarsusc + mtempc + windsc + rhc + (1+mtempc|id), data=ndf, REML=0) In order to compare these two models I would use a LRT test: anova(m1,m2) However, LRT test is not recommended when Corr is near the extremes (+1,-1). So, how I compare the fit of two models in lme4 when the correlation between two random effects are near the extremes?
You can always look at the likelihood ratio, the question is whether it follows a simple chi-square distribution under the null or not. If the LR is large enough, then it probably won't matter anyway. You can obtain percentiles by an appropriate simulation based on your data setup, especially since m1 only has id as a random effect. ?I don't think the RLRsim package can be used here, but its author may clarify on that.
I agree with David that you can always look at the likelihood ratio and if its value is very large then whether or not the chi-square approximation to the change in the deviance is accurate you will still have strong evidence that the random effects correlation is non-negligible. However, I think you are comparing the wrong models. You should compare m2 to the same model but with random effects of the form (1|id) + (0+mtempc|id) if you want to isolate the correlation parameter.