[R-sig-ME] postVar in ranef function
Hester Lingsma
h.lingsma at erasmusmc.nl
Fri Feb 5 11:16:36 CET 2010
Dear Prof Bates,
Thank you very much for the reply. You already solved my problem, I
indeed did not notice that the printed output from ranef doesn't change
with postVar =TRUE. Very stupid. Thanks again!
Hester Lingsma
on 04-02-2010 16:13 Douglas Bates said the following:
> Could you provide a reproducible example, please? In the example
> below I don't see a changed behavior.
>
> Note that the printed output from ranef doesn't change with postVar =
> TRUE. The conditional variance-covariance matrices are attached as an
> attribute.
>
>
>> (fm1 <- lmer(Reaction ~ 1 + Days + (1 + Days|Subject), sleepstudy))
>>
> Linear mixed model fit by REML
> Formula: Reaction ~ 1 + Days + (1 + Days | Subject)
> Data: sleepstudy
> AIC BIC logLik deviance REMLdev
> 1756 1775 -871.8 1752 1744
> Random effects:
> Groups Name Variance Std.Dev. Corr
> Subject (Intercept) 612.090 24.7405
> Days 35.072 5.9221 0.066
> Residual 654.941 25.5918
> Number of obs: 180, groups: Subject, 18
>
> Fixed effects:
> Estimate Std. Error t value
> (Intercept) 251.405 6.825 36.84
> Days 10.467 1.546 6.77
>
> Correlation of Fixed Effects:
> (Intr)
> Days -0.138
>
>> str(ranef(fm1))
>>
> List of 1
> $ Subject:'data.frame': 18 obs. of 2 variables:
> ..$ (Intercept): num [1:18] 2.26 -40.4 -38.96 23.69 22.26 ...
> ..$ Days : num [1:18] 9.2 -8.62 -5.45 -4.81 -3.07 ...
> - attr(*, "class")= chr "ranef.mer"
>
>> str(ranef(fm1, postVar = TRUE))
>>
> List of 1
> $ Subject:'data.frame': 18 obs. of 2 variables:
> ..$ (Intercept): num [1:18] 2.26 -40.4 -38.96 23.69 22.26 ...
> ..$ Days : num [1:18] 9.2 -8.62 -5.45 -4.81 -3.07 ...
> ..- attr(*, "postVar")= num [1:2, 1:2, 1:18] 145.71 -21.44 -21.44
> 5.31 145.71 ...
> - attr(*, "class")= chr "ranef.mer"
>
>> sessionInfo()
>>
> R version 2.10.1 (2009-12-14)
> x86_64-pc-linux-gnu
>
> locale:
> [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
> [3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
> [5] LC_MONETARY=C LC_MESSAGES=en_US.UTF-8
> [7] LC_PAPER=en_US.UTF-8 LC_NAME=C
> [9] LC_ADDRESS=C LC_TELEPHONE=C
> [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
>
> attached base packages:
> [1] stats graphics grDevices utils datasets methods base
>
> other attached packages:
> [1] lme4_0.999375-32 Matrix_0.999375-33 lattice_0.18-3
>
> loaded via a namespace (and not attached):
> [1] grid_2.10.1 tools_2.10.1
>
>
> ranef(myModel, postVar = TRUE)
>
>
>
>
> On Thu, Feb 4, 2010 at 5:32 AM, Hester Lingsma <h.lingsma at erasmusmc.nl> wrote:
>
>> Dear R users,
>> For some strange reason the postVar=T statement in the extraction of the
>> random effects (with ranef) is not working anymore. I use ranef (model1,
>> postVar=T) but I just get the posterior estimates, not the variance. In the
>> past it worked fine. Does anyone have an idea what is happening here?
>> Best wishes,
>> Hester
>>
>> --
>> _________________________________________________
>> Hester F. Lingsma, MSc
>> Dept of Public Health
>> Room AE-141
>> Erasmus MC
>> P.O. Box 2040
>> 3000 CA Rotterdam
>> The Netherlands
>> Phone: (+31) (0)10 7038458/7038460
>> Mobile: (+31) (0)6 26467338
>>
>> _______________________________________________
>> R-sig-mixed-models at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>>
>>
--
_________________________________________________
Hester F. Lingsma, MSc
Dept of Public Health
Room AE-141
Erasmus MC
P.O. Box 2040
3000 CA Rotterdam
The Netherlands
Phone: (+31) (0)10 7038458/7038460
Mobile: (+31) (0)6 26467338
More information about the R-sig-mixed-models
mailing list