[R-sig-ME] How is the covariance factor computed?
Christian Brauner
christianvanbrauner at gmail.com
Thu Jul 17 17:41:25 CEST 2014
Hello,
I am performing a priori power simulations for mixed-effect models based
on previous experiments. This works out quite nicely. I extract parts of
my parameters from a previous model I fitted:
prev_mod <- lmer(Y ~ A
+ (B | Context)
+ (B | Subjects),
data =3D data)
"A" :=3D 2 level factor
"Context" :=3D 40 level factor
"Subjects" :=3D 70 level factor
create design matrices for the fixed- and each random effect use functions from
the apply-family and bind them to a previously set-up data frame and so on.
In order to simulate data I draw from two multivariate distributions. One
for Subjects and one for Context. I previously constructed the
variance-covariance matrix by using the estimations I get by issuing
"as.data.frame(prev_mod)". After having read that Doug implemented a new
method for the "getME()" extractor "Tlist" that gives the covariance
factors from which the block matrices in "Lambda" are created I figured I
could get the variance-covariance matrix way easier by doing (code here
only for the "Context" variance-covariance matrix):
cov_fac <- getME(prev_mod, "Tlist")
cov_fac_context <- cov_fac$Context
sigma(prev_mod)^2*cov_fac_context%*%t(cov_fac_context)
But the question that has been haunting me for weeks now is how the individual
covariance factors (better: "matrices" in this case) that I can extract via
"getME(prev_mod, "Tlist") are computed. Is there some literature on that? I
couldn't find any apart from the paper "Fitting linear mixed-effects models
using lme4" published 23.06.2014. I would be interested in reading up/get an
explanation how the covariance factor can be computed (mathematically and in
lme4) and if I need the variance-covariance matrix beforehand or vica versa.
Thank for any help!
Best,
Christian Brauner
Eberhard Karls Universit=C3=A4t T=C3=BCbingen
Mathematisch-Naturwissenschaftliche Fakult=C3=A4t - Faculty of Science
Evolutionary Cognition - Cognitive Science
Schleichstra=C3=9Fe 4 =C2=B7 72076 T=C3=BCbingen =C2=B7 Germany
Telefon +49 7071 29-75643 =C2=B7 Telefax +49 7071 29-4721
christianvanbrauner at gmail.com
More information about the R-sig-mixed-models
mailing list