[R-sig-ME] Modeling correlation structure in mixed models

ONKELINX, Thierry Thierry.ONKELINX at inbo.be
Mon Jun 29 09:25:46 CEST 2009

Dear all,

A small remark on Gregor comment about the correlation structure in
lme4. It can handle two kind of correlation structures within the random
effects: a symmetric variance-covariance matrix (unstructured in SAS
terminology) and independent random effects.

lmer(y ~ a + (1 + x|b))
#symmetric variance-covariance matrix
z11 z12
Z12 z22
#equivalent to the default in nlme (pdSymm)

lmer(y ~ a + (1|b) + (x - 1|b))
#indepent random effects
z11 0
0   z22
#equivalent to pdDiag in nlme

nlme allows for several other correlation structures. Have a look at
?pdClasses. If you can't find the structure you need / like, then you
can allow code your own pdClass. But if you have a limited number of
years and a lot of data, then I would stick to an existing structure
like pdSymm. It will be less efficient than the 'true' structure in your
data, but you need much less assumptions on your model.



ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature
and Forest
Cel biometrie, methodologie en kwaliteitszorg / Section biometrics,
methodology and quality assurance
Gaverstraat 4
9500 Geraardsbergen
tel. + 32 54/436 185
Thierry.Onkelinx at inbo.be

To call in the statistician after the experiment is done may be no more
than asking him to perform a post-mortem examination: he may be able to
say what the experiment died of.
~ Sir Ronald Aylmer Fisher

The plural of anecdote is not data.
~ Roger Brinner

The combination of some data and an aching desire for an answer does not
ensure that a reasonable answer can be extracted from a given body of
~ John Tukey

-----Oorspronkelijk bericht-----
Van: r-sig-mixed-models-bounces at r-project.org
[mailto:r-sig-mixed-models-bounces at r-project.org] Namens Gregor Gorjanc
Verzonden: zaterdag 27 juni 2009 15:10
Aan: r-sig-mixed-models at r-project.org
Onderwerp: Re: [R-sig-ME] Modeling correlation structure in mixed models


Here are my 2 cents.

As far as I know, there is no way in lmer to specify anything but a
simple random effect (though there is ZStar package on R-forge that can
be used to infiltrate some nifty covar. structures as has been for
example been done in pedigreemm package). However, this does not mean
that only residual has a covariance matrix, which is actually a identity
matrix times a residual variance.

Take for example a model with three effects: a, b, and c. Both b and c
are to be modelled as 'random' effect. Then the lmer code is something

lmer(y ~ a + (1 | b) + (1 | c))

This assumes the following model

y_ijk = a_i + b_j + c_k + e_ijk

note that a, b, and c need not be nested! The variance assumptions are

Var(y) = \sigma^2_b + \sigma^2_c + \sigma^2_e

Now for two records that come from the same b_j but not the same c_k, we

Cov(y_1, y_2) = \sigma^2_b + \sigma^2_e

etc. However, there is no way to say that there is correlation between
different levels of b or c as can bee done in SAS (PROC MIXED) with a
variety of covariance matrices - full, ... That is at least from what I
know - Douglas can "pop in" here if I am wrong.

Additional thing that is possible in lmer is to use

lmer(y ~ a + x + (1 + x | b) + (1 | c))

which is the so called "random regression" model or "varying intercept
and varying slope" model or ... Here we have a 2x2 covariance matrix for
the effect of b.

Finally, my experience is that PROC MIXED my choke on large datasets,
while lmer handles them due to the use of sparse matrix techniques[1],
though there is some progress on this matter at SAS[2].

Regards, gg


R-sig-mixed-models at r-project.org mailing list

Dit bericht en eventuele bijlagen geven enkel de visie van de schrijver weer 
en binden het INBO onder geen enkel beding, zolang dit bericht niet bevestigd is
door een geldig ondertekend document. The views expressed in  this message 
and any annex are purely those of the writer and may not be regarded as stating 
an official position of INBO, as long as the message is not confirmed by a duly 
signed document.

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