[R] Finding covariance in a lmer mixed effects model
Kurt Smith
smith.kurt.a at gmail.com
Thu Nov 12 05:56:09 CET 2009
I am having difficulty finding the covariance for the random effects in
a mixed effects model.
I fit this model:
fm1 <- lmer(fpg ~ 1 + time + (1|ID) + (0+time|ID),fpg_lme)
and want to find the covariance between the time and intercept random effects.
I tried using VarCorr (see below) but it does not give the covariance
or correlation between the random effects. Am I doing something wrong?
Thanks,
Kurt
> summary(fm1)
Linear mixed model fit by REML
Formula: fpg ~ 1 + time + (1 | ID) + (0 + time | ID)
Data: fpg_lme
AIC BIC logLik deviance REMLdev
1499289 1499339 -749639 1499259 1499279
Random effects:
Groups Name Variance Std.Dev.
ID (Intercept) 1.0396e+03 32.2435465
ID time 1.2199e-05 0.0034926
Residual 1.1241e+02 10.6025764
Number of obs: 174042, groups: ID, 55526
Fixed effects:
Estimate Std. Error t value
(Intercept) 1.108e+02 1.421e-01 779.9
time 2.106e-03 6.678e-05 31.5
Correlation of Fixed Effects:
(Intr)
time -0.163
> VarCorr(fm1)
$ID
(Intercept)
(Intercept) 1039.646
attr(,"stddev")
(Intercept)
32.24355
attr(,"correlation")
(Intercept)
(Intercept) 1
$ID
time
time 1.219857e-05
attr(,"stddev")
time
0.003492645
attr(,"correlation")
time
time 1
attr(,"sc")
sigmaREML
10.60258
More information about the R-help
mailing list