Skip to contents

Extracts estimated variance-covariance matrices for random effects and residual variances from a fitted model.

Usage

variance_components(
  object,
  class = "all",
  format = c("matrix", "vector", "dataframe")
)

Arguments

object

Fitted SurveyMixrRE object

class

Specific class to extract (default = "all")

format

Character: "matrix" (default), "vector", or "dataframe"

Value

Variance components in requested format

Examples

if (FALSE) { # \dontrun{
# Note: Random effects functionality is under development
fit <- gmm_survey_re(
  data = mcs_simulated,
  id = "id", time = "age", outcome = "selfcontrol",
  n_classes = 3, random = ~ 1 + age, starts = 100
)

# Get all variance components
vc <- variance_components(fit)
print(vc)

# Get for specific class
vc_class1 <- variance_components(fit, class = 1)
} # }