Skip to contents

Extract variance and correlation components from model

Usage

# S3 method for class 'galamm'
VarCorr(x, sigma = 1, ...)

Arguments

x

An object of class galamm returned from galamm.

sigma

Numeric value used to multiply the standard deviations. Defaults to 1.

...

Other arguments passed onto other methods. Currently not used.

Value

An object of class c("VarCorr.galamm", "VarCorr.merMod").

Examples

# Linear mixed model with heteroscedastic residuals
mod <- galamm(
  formula = y ~ x + (1 | id),
  weights = ~ (1 | item),
  data = hsced
)

# Extract information on variance and covariance
VarCorr(mod)
#>  Groups   Name        Std.Dev. Variance
#>  id       (Intercept) 0.99400  0.98804 
#>  Residual             0.97964  0.95970 

# Convert to data frame
# (this invokes lme4's function as.data.frame.VarCorr.merMod)
as.data.frame(VarCorr(mod))
#>        grp        var1 var2      vcov     sdcor
#> 1       id (Intercept) <NA> 0.9880425 0.9940033
#> 2 Residual        <NA> <NA> 0.9596999 0.9796427