kr-vcovAdj.RdKenward and Roger (1997) describe an improved small sample approximation to the covariance matrix estimate of the fixed parameters in a linear mixed model.
vcovAdj(object, details = 0)
# S3 method for class 'lmerMod'
vcovAdj(object, details = 0)the estimated covariance matrix, this has attributed P, a
list of matrices used in KR_adjust and the estimated matrix W of
the variances of the covariance parameters of the random effects
list: Sigma: the covariance matrix of Y; G: the G matrices that
sum up to Sigma; n.ggamma: the number (called M in the article) of G
matrices)
If $N$ is the number of observations, then the vcovAdj()
function involves inversion of an $N x N$ matrix, so the computations can
be relatively slow.
Ulrich Halekoh, Søren Højsgaard (2014)., A Kenward-Roger Approximation and Parametric Bootstrap Methods for Tests in Linear Mixed Models - The R Package pbkrtest., Journal of Statistical Software, 58(10), 1-30., https://www.jstatsoft.org/v59/i09/
Kenward, M. G. and Roger, J. H. (1997), Small Sample Inference for Fixed Effects from Restricted Maximum Likelihood, Biometrics 53: 983-997.
fm1 <- lmer(Reaction ~ Days + (Days|Subject), sleepstudy, REML=TRUE)
class(fm1)
#> [1] "lmerMod"
#> attr(,"package")
#> [1] "lme4"
set.seed(123)
sleepstudy2 <- sleepstudy[sample(nrow(sleepstudy), size=120), ]
fm2 <- lmer(Reaction ~ Days + (Days|Subject), sleepstudy2, REML=TRUE)
## Here the adjusted and unadjusted covariance matrices are identical,
## but that is not generally the case:
v1 <- vcov(fm1)
v1a <- vcovAdj(fm1, details=0)
v1a / v1
#> 2 x 2 Matrix of class "dgeMatrix"
#> (Intercept) Days
#> (Intercept) 1 1
#> Days 1 1
v2 <- vcov(fm2)
v2a <- vcovAdj(fm2, details=0)
v2a / v2
#> 2 x 2 Matrix of class "dgeMatrix"
#> (Intercept) Days
#> (Intercept) 1.008841 1.046870
#> Days 1.046870 1.009213
# For comparison, an alternative estimate of the
# variance-covariance matrix is based on parametric bootstrap (and
# this is easily parallelized):