[R-sig-ME] Help understanding residual variance

Ista Zahn istazahn at gmail.com
Thu Mar 29 05:02:58 CEST 2012


Hello again,

Sorry for bringing this up again. The thing is that a statistician
consulting with my research group insists that you cannot have both
random intercepts and random slopes when there are only two
observations per group. Clearly I can fit such a model using lmer(),
but this only serves to convince my local statistician that "R is
doing something strange". I suspect that this is a hopelessly vague
question, but is R doing something strange? Or is my statistician
incorrect in claiming that you can't fit both random intercepts and
random slopes with only two observations per group?

Again, I realize this is not a great question, but I would really
appreciate any thoughts on the matter.

Best,
Ista
On Tue, Mar 27, 2012 at 2:55 PM, Ista Zahn <istazahn at gmail.com> wrote:
> Thank you Greg, that helps.
>
> -Ista
>
> On Tue, Mar 27, 2012 at 11:32 AM, Greg Snow <538280 at gmail.com> wrote:
>>
>> Yes, each person has their own slope and intercept estimated, however
>> the slope and intercept are not determined solely by the 2 data points
>> for that person, but also are affected by the slope and intercept
>> estimates across all subjects (this is why lmer gives value beyond
>> lmList).
>>
>> You can see this if you refit using the nlme package (only because it
>> has the augPred function which has not been implemented in lme4 yet):
>>
>> library(nlme)
>> m2 <- lme( Reaction ~ Days, data=tmp, random=~Days|Subject)
>> plot(augPred(m2, ~Days, level=c(0,1)))
>>
>> comparing the m2 model to your m1 gives the same fixed effects, but
>> slightly different random effects (I probably did not do something
>> that was needed to make the models exactly the same) but is probably
>> close enough.
>>
>> Look at the plot and you will see the fixed effects line, the line for
>> each subject that includes the random effects, and the data.  The line
>> for the individual subjects are pulled slightly towards the fixed
>> effects line and so does not hit the 2 points exactly.  This shows how
>> the estimate of each individuals values are influenced by the overall
>> fit.
>>
>>
>> On Mon, Mar 26, 2012 at 8:18 PM, Ista Zahn <istazahn at gmail.com> wrote:
>> > Hi all,
>> >
>> > I'm trying to understand what the residual variance in this model:
>> >
>> > tmp <- subset(sleepstudy, Days == 1 | Days == 9)
>> > m1 <- lmer(Reaction ~ 1 + Days + (1 + Days | Subject), data = tmp)
>> > tmp$fitted1 <- fitted(m1)
>> >
>> > represents. The way I read this specification, an intercept and a
>> > slope is estimated for each subject. Since each subject only has two
>> > measurements, I would expect the Reaction scores to be completely
>> > accounted for by the slopes and intercepts. Yet they are not: the
>> > Residual variance estimate is 440.278.
>> >
>> > This is probably a stupid question, but I hope you will be kind enough
>> > to humor me.
>> >
>> > Best,
>> > Ista
>> >
>> > _______________________________________________
>> > R-sig-mixed-models at r-project.org mailing list
>> > https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>>
>>
>>
>> --
>> Gregory (Greg) L. Snow Ph.D.
>> 538280 at gmail.com




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