[R-sig-ME] bVar slot of lmer objects and standard errors

Doran, Harold HDoran at air.org
Wed Apr 4 15:44:44 CEST 2007


The proper way to do this is to use the extractor function

attr(ranef(fm1, postVar = TRUE)[[1]], "postVar") 

Reaching into the slots, as I've learned, can give unstable results. Now, the results are different, and assuming that the unscaled results coming out by reaching into the bvar slot are stable, it appears the difference is that the scale factor used in the extractor function is slightly larger than the scale factor obtained from your s1.

I'm scratching my head a bit still because the scale factor using the extractor function appears to be different for the intercept and slope.

Of course, this is assuming the unscaled estimates coming out of the bVar slot are correct, and this may be a totally false assumption. 

> -----Original Message-----
> From: r-sig-mixed-models-bounces at r-project.org 
> [mailto:r-sig-mixed-models-bounces at r-project.org] On Behalf 
> Of Jorge González
> Sent: Wednesday, April 04, 2007 3:05 AM
> To: r-sig-mixed-models at r-project.org
> Subject: [R-sig-ME] bVar slot of lmer objects and standard errors
> 
> Dear all,
> 
> Sorry if this is not the correct list for this kind of questions.
> 
> In the well known example from lme4 library 
> 
> fm1 <- lmer(Reaction ~ Days + (Days|Subject), sleepstudy)
>  
> if you consider that (s1^2)*fm1 at bVar$Subject is the posterior 
> covariance matrix where s1<-attr(VarCorr(fm1),"sc") (as 
> indicated in the following post 
> (http://tolstoy.newcastle.edu.au/R/help/05/12/17977.html), 
> then, what would attr(p.bs[[1]], "postVar") with p.bs <- 
> ranef(fm1, postVar = TRUE) be? According to help(ranef), 
> postVar is an optional logical argument indicating if the 
> conditional variance covariance matrices, also called the 
> "posterior variances", of the random effects should be included.
> 
> You can check that the results are certainly not the same. 
> Then, which one is the correct posterior covariance matrix 
> for the empirical bayes estimates?
> 
> Thank you very much in advance.
> 
> Jorge
> 
> --
>  _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
> |Jorge González                                               
>         |
> |Faculty of Psychology                                        
>         |
> |Research Group of Quantitative Psychology and Individual 
> Differences |
> |jorge.gonzalez at psy.kuleuven.be                               
>         |
> |http://perswww.kuleuven.be/jorge_gonzalez                    
>         |
> |http://www.kuleuven.be/cv/u0045204e.htm                      
>         |
> |_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
> -_-_-_-_|
> 
> 
> 
> 
> Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm
> 
> _______________________________________________
> R-sig-mixed-models at r-project.org mailing list 
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>




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