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.133900e+04
#> Tau.case.var((Intercept))                 -2.140289e+04
#> cor_params                                -1.004342e-02
#> sigma_sq                                  -4.701744e+02
#>                             Tau.case.var((Intercept))    cor_params
#> Tau.school.var((Intercept))             -2.140289e+04 -0.0100434219
#> Tau.case.var((Intercept))                3.996251e+05 -8.2280433012
#> cor_params                              -8.228043e+00  0.0002154736
#> sigma_sq                                -3.815479e+05  9.8729751627
#>                                  sigma_sq
#> Tau.school.var((Intercept)) -4.701744e+02
#> Tau.case.var((Intercept))   -3.815479e+05
#> cor_params                   9.872975e+00
#> sigma_sq                     4.602107e+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.650376e+04
#> Tau.case.var((Intercept))                 -1.002118e+04
#> cor_params                                 4.502481e-02
#> sigma_sq.baseline                          1.053265e+03
#> sigma_sq.treatment                         1.828453e+03
#>                             Tau.case.var((Intercept))    cor_params
#> Tau.school.var((Intercept))             -10021.178653  0.0450248054
#> Tau.case.var((Intercept))                75198.102744 -1.9990651534
#> cor_params                                  -1.999065  0.0001064976
#> sigma_sq.baseline                       -61234.417984  2.9076380204
#> sigma_sq.treatment                      -76051.418675  4.0240875929
#>                             sigma_sq.baseline sigma_sq.treatment
#> Tau.school.var((Intercept))       1053.264890        1828.453115
#> Tau.case.var((Intercept))       -61234.417984      -76051.418675
#> cor_params                           2.907638           4.024088
#> sigma_sq.baseline                88587.446312      111841.918017
#> sigma_sq.treatment              111841.918017      160901.251254