Skip to content
Prev 19981 / 20628 Next

How to find ACF, PACF, Sample Variance-Covariance Matrix of Random-Effects?

Can you give an example please?

   The covariance matrix is typically (for nlme and other packages that 
follow the same conventions) extracted with VarCorr().  As described in 
my other e-mail to the list, this is not *quite* the same as the full 
covariance matrix of the random-effects vector, but rather the 
covariance matrix for a single grouping variable/block.  VarCorr() 
returns a list.  So e.g. if

library(lme4)
fm1 <- lmer(Reaction ~ Days + (Days|Subject), sleepstudy)


VarCorr(fm1)$Subject gives a 2x2 covariance matrix

cov2cor() will convert this to a correlation matrix.

Or, for lmer fits at least, the correlation is already present as an 
attribute:

attr(VarCorr(fm1)$Subject, "correlation")
On 2022-10-07 9:43 a.m., Sun, John wrote: