Estimate the sampling variance-covariance of variance component parameters from a fitted linear mixed effects model (lmeStruct object) or generalized least squares model (glsStruct object) using the inverse Fisher information.

varcomp_vcov(mod, type = "expected", separate_variances = FALSE)

Arguments

mod

Fitted model of class lmeStruct or glsStruct.

type

Type of information matrix. One of "expected" (the default), "observed", or "average".

separate_variances

Logical indicating whether to return the Fisher information matrix for separate level-1 variance components if using varIdent function to allow for different variances per stratum. Default is FALSE.

Value

Sampling variance-covariance matrix corresponding to variance component parameters of mod.

Examples


library(nlme)
data(Bryant2016)
Bryant2016_RML <- lme(fixed = outcome ~ treatment,
                      random = ~ 1 | school/case,
                      correlation = corAR1(0, ~ session | school/case),
                      data = Bryant2016)
varcomp_vcov(Bryant2016_RML, type = "expected")
#>                             Tau.school.var((Intercept))
#> Tau.school.var((Intercept))                8.133897e+04
#> Tau.case.var((Intercept))                 -2.140288e+04
#> cor_params                                -1.004342e-02
#> sigma_sq                                  -4.701742e+02
#>                             Tau.case.var((Intercept))    cor_params
#> Tau.school.var((Intercept))             -2.140288e+04 -0.0100434221
#> Tau.case.var((Intercept))                3.996247e+05 -8.2280389067
#> cor_params                              -8.228039e+00  0.0002154736
#> sigma_sq                                -3.815475e+05  9.8729705296
#>                                  sigma_sq
#> Tau.school.var((Intercept)) -4.701742e+02
#> Tau.case.var((Intercept))   -3.815475e+05
#> cor_params                   9.872971e+00
#> sigma_sq                     4.602103e+05

Bryant2016_RML2 <- lme(fixed = outcome ~ treatment,
                      random = ~ 1 | school/case,
                      correlation = corAR1(0, ~ session | school/case),
                      weights = varIdent(form = ~ 1 | treatment),
                      data = Bryant2016)
varcomp_vcov(Bryant2016_RML2, separate_variances = TRUE)
#>                             Tau.school.var((Intercept))
#> Tau.school.var((Intercept))                7.650378e+04
#> Tau.case.var((Intercept))                 -1.002118e+04
#> cor_params                                 4.502481e-02
#> sigma_sq.baseline                          1.053266e+03
#> sigma_sq.treatment                         1.828454e+03
#>                             Tau.case.var((Intercept))    cor_params
#> Tau.school.var((Intercept))             -10021.184349  0.0450248142
#> Tau.case.var((Intercept))                75198.149282 -1.9990654654
#> cor_params                                  -1.999065  0.0001064976
#> sigma_sq.baseline                       -61234.457795  2.9076385241
#> sigma_sq.treatment                      -76051.465666  4.0240881679
#>                             sigma_sq.baseline sigma_sq.treatment
#> Tau.school.var((Intercept))       1053.265669        1828.454299
#> Tau.case.var((Intercept))       -61234.457795      -76051.465666
#> cor_params                           2.907639           4.024088
#> sigma_sq.baseline                88587.503569      111841.989389
#> sigma_sq.treatment              111841.989389      160901.347442