[R-sig-ME] lmer syntax

Douglas Bates bates at stat.wisc.edu
Mon Apr 7 19:59:51 CEST 2008


On Mon, Apr 7, 2008 at 12:34 PM, Michael Kubovy <kubovy at virginia.edu> wrote:
> Dear lme4 folk,

> The lmer help page gives two examples:
>  (fm1 <- lmer(Reaction ~ Days + (Days|Subject), sleepstudy))
> (fm2 <- lmer(Reaction ~ Days + (1|Subject) + (0+Days|Subject), sleepstudy))
> How is the following different, in principle, from the above? Is it that the
> above treats (Intercept) and Days as orthogonal, whereas the latter checks
> to see if they are? What would be appropriate if the correlation between
> Days and Intercept (here 0.067, apparently) were large?
> (fm3 <- lmer(Reaction ~ Days + (1 + Days | Subject), sleepstudy))

Model fm3 is equivalent to model fm1.  In the linear model formula
language used in the S language, the intercept term is implicit so the
random-effects term (Days|Subject) is equivalent to (1+Days|Subject).
Some authors, notably Gelman and Hill in their 2007 book, prefer to
use the second form so that the presence of the intercept is explicit.
 I can see the point of that.

Every random effect is associated with one and only one random-effects
term in the model formula and with one and only one level of the
grouping factor for that random-effects term.  The general rules for
determining the variance-covariance of the random effects (as fit in
lmer) are:

 - random effects associated with different terms are independent
 - random effects associated with the same term but with different
levels of the grouping factor are independent
 - within a term the random effects may be partitioned according to
the levels of the grouping factor.  The variance-covariance matrix of
the vector of random effects associated with each of these levels of
the grouping factor is a constant, symmetric, positive semidefinite
matrix.  It has no additional constraints other than being symmetric
and positive semidefinite.  (In SAS-speak this is called an
"unstructured" variance-covariance matrix but the mathematician in me
refuses to accept the concept of an unstructured, symmetic, positive
semidefinite matrix.)

(Note that when I refer to "levels" in the above description I am
referring to the S-language concept of the levels of a factor, not
levels of random effects in the sense of multilevel models.)

In practice the difference between the two models is that fm2 is a
restricted form of fm1/fm3 in which the correlation of the random
effects has been set to zero.

> ……………
> Random effects:
> Groups Name Variance Std.Dev. Corr
> Subject (Intercept) 610.8 24.72
>  Days 35.1 5.92 0.067
> Residual 655.1 25.59
>
>
>
> _____________________________
> Professor Michael Kubovy
> University of Virginia
> Department of Psychology
> USPS:     P.O.Box 400400    Charlottesville, VA 22904-4400
> Parcels:    Room 102        Gilmer Hall
>         McCormick Road    Charlottesville, VA 22903
> Office:    B011    +1-434-982-4729
> Lab:        B019    +1-434-982-4751
> Fax:        +1-434-982-4766
> WWW:    http://www.people.virginia.edu/~mk9y/
>
>




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