[R-sig-ME] quick question regarding your "residual" command for your lmer command - please help me

Douglas Bates bates at stat.wisc.edu
Tue Aug 28 16:25:12 CEST 2012

I have taken the liberty of cc:'ing the
R-SIG-Mixed-Models at R-project.org mailing list on this reply.  Many of
those who read that list will be able to help you, often more quickly
than I am able to do.

Your question is a bit confusing in that you say you are using lmer
and then quote the documentation for residuals.lme.  The nlme package,
containing lme and supporting methods, and the lme4 package,
containing lmer, are different.  You should not expect the
documentation for one to apply to the other.

On Tue, Aug 28, 2012 at 8:20 AM, Yugo Nakamura <yugonakamura25 at gmail.com> wrote:
> To Professor Bates,
> I am terribly sorry for this impromptu email.  I have been using your lmer
> command for my dissertation (at the University of Washington) but I am
> having some difficulty to fully understand the outputs.  Your expertise will
> be deeply appreciated.  I would like to thank you in advance for your time.
> My question pertains to the Residual command of the lmer and the variance
> estimates of the level 1 residuals in the  lmer output.  I am not certain as
> to how these figures are calculated and what these estimates really imply.
> The definition of the residual are as follow.
> residuals.lme {nlme}
> The residuals at level i are obtained by subtracting the fitted levels at
> that level from the response vector (and dividing by the estimated
> within-group standard error, if type="pearson"). The fitted values at level
> i are obtained by adding together the population fitted values (based only
> on the fixed effects estimates) and the estimated contributions of the
> random effects to the fitted values at grouping levels less or equal to i
> http://stat.ethz.ch/R-manual/R-patched/library/nlme/html/residuals.lme.html
> Is this definition saying that, the residuals are defined by subtracting the
> fitted values from the fixed effects and the empirical Bayes estimate of the
> level 2 residuals?
> I calculated the variance of these residuals and it gave me the same
> estimate of the variance estimate of the "Residuals" (level 1) in the lmer
> output.
> But my question then is, is this variance estimate the "within group
> variance" explained in different textbooks of multilevel analysis?  But if
> so I find it slightly too big..  I have learned that within group variance
> are normally distributed with mean zero and constant variance for each and
> every group.   That is, the variance is calculated within/for each and every
> group and this variance is constant across all groups (quite strong
> assumption).
> But the variance estimate and the residual command above seems to give us
> the pooled residuals regardless of the groups.  That is, the variance is the
> estimate of the variance across all the residuals regardless/ignoring of the
> group.   Is this so?   If this is the case, isn't this variance the sum of
> all the within group variances (simply because the sum of normal
> distribution is also a normal distribution with the mean and variance also
> summed)?  Thus, to get a within group variance (for each group) I should
> divide your Residual variance estimate by the number of groups?
> I hope I was able to make sense.  It will be great if you could share me
> your expertise.    If there is a link that describes all the details of your
> command, that will be very helpful as well.
> Thank you so much in advance for your time and cooperation!
> yours,
> Yugo Nakamura

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