[R-sig-ME] Modeling correlation structure in mixed models
Gregor Gorjanc
gregor.gorjanc at bfro.uni-lj.si
Sat Jun 27 15:09:33 CEST 2009
Hi,
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 like
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 have
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
[1]http://ggorjan.blogspot.com/2008/07/proc-mixed-vs-lmer.html
[2]http://support.sas.com/documentation/cdl/en/statug/59654/HTML/default/statug_hpmixed_sect001.htm
More information about the R-sig-mixed-models
mailing list