[R] Using lme (nlme) to find the conditional varianceof therandom effects

Doran, Harold HDoran at air.org
Tue Nov 13 15:07:57 CET 2007


Yes. The variances are an attribute, and you can grab them like this:

fm1 <- lmer(Reaction ~ Days + (Days|Subject), sleepstudy)
attr(ranef(fm1, postVar = TRUE)[[1]], "postVar") 

> -----Original Message-----
> From: r-help-bounces at r-project.org 
> [mailto:r-help-bounces at r-project.org] On Behalf Of Rick Bilonick
> Sent: Tuesday, November 13, 2007 1:04 AM
> To: R Help
> Subject: Re: [R] Using lme (nlme) to find the conditional 
> varianceof therandom effects
> 
> On Mon, 2007-11-12 at 16:45 -0500, Doran, Harold wrote:
> > No, don't reach into the bVar slot. Use the proper 
> extractor function
> > ranef() with postVar=T. There is no similar function for lme()
> > 
> > > -----Original Message-----
> > > From: r-help-bounces at r-project.org
> > > [mailto:r-help-bounces at r-project.org] On Behalf Of Rick Bilonick
> > > Sent: Monday, November 12, 2007 4:40 PM
> > > To: R Help
> > > Subject: [R] Using lme (nlme) to find the conditional variance of 
> > > therandom effects
> > > 
> > > Using lmer in the lme4 package, you can compute the conditional 
> > > variance-covariance matrix of the random effects using the bVar 
> > > slot:
> > > 
> > > bVar: A list of the diagonal inner blocks (upper triangles
> > > only) of the positive-definite matrices on the diagonal of the 
> > > inverse of ZtZ+Omega.
> > > With the appropriate scale factor (and conversion to a symmetric 
> > > matrix) these are the conditional variance-covariance matrices of 
> > > the random effects.
> > > 
> > > Is there anything similar in the nlme package using the 
> lme function?
> > > 
> > > Rick B.
> > > 
> > > ______________________________________________
> 
> 
> Is there some way to get ranef with postVar=TRUE to show what 
> the variances are, or what the lower and upper bounds are? 
> qqmath makes nice plots but I need to obtain the numerical values.
> 
> Rick B.
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide 
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
> 



More information about the R-help mailing list