[R-sig-ME] Expected correlation in a mixed model
Ben Bolker
bbolker at gmail.com
Mon Nov 22 16:07:36 CET 2010
However: centering the concentration doesn't actually have much effect
in this example (which it would if the remoteness from the origin were
the problem), i.e.
concsc <- scale(conc)
(lmer1<-lmer(od~concsc+(concsc|run)))
This setup seems a little bit odd to me:
* the data set size is fairly small -- only 4 levels of the random
effect ('run'), which often leads to this sort of collapse (zero
variances and/or perfect correlations)
* there is no variation in slopes across runs (the only randomness
here is the error term). Perhaps what you're looking for is
(lmer2<-lmer(od~concsc+(1|run) + (0+concsc|run)))
which fixes the correlation at zero.
* it's also the case here that the random effect on the intercept of
'run' is uniformly distributed, rather than normal -- I don't know if
that would have an effect.
Ben Bolker
On 11/22/2010 09:44 AM, Andrew Robinson wrote:
> Yes indeed --- remoteness of the data from the origin is a plausible
> explanation.
>
> Cheers
>
> Andrew
>
> On Mon, Nov 22, 2010 at 8:50 PM, S Ellison <S.Ellison at lgc.co.uk> wrote:
>
>> Forgive the possibly numb-brained question, but is there a reason why
>> the correlation between random effects coefficients in lmer should come
>> out as identically 1.0 in a model of the form
>>
>> lmer(x ~ a + (a|b) )
>>
>> ?
>>
>> An example:
>> set.seed(403)
>> require(lme4)
>> run <- gl(4, 15)
>> conc <- rep(rep(c(0,0.1, 0.2, 0.4, 1.0), 3), 4)
>> boxplot(conc~run)
>> offset=0.2*as.numeric(run)
>> od <- offset+conc+rnorm(60, 0, 0.2)
>> plot(conc, od)
>>
>> (lmer1<-lmer(od~conc+(conc|run)))
>> VarCorr(lmer1)
>>
>>
>> S Ellison
>> LGC
>>
>> *******************************************************************
>> This email and any attachments are confidential. Any u...{{dropped:21}}
>
> _______________________________________________
> R-sig-mixed-models at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
More information about the R-sig-mixed-models
mailing list