This has functionality for simpler models from lme4
,
glmmTMB
, nlme
, and brms
.
extract_vc( model, ci_level = 0.95, ci_args = NULL, ci_scale = "sd", show_cor = FALSE, digits = 3, component = "cond", ... ) # S3 method for merMod extract_vc( model, ci_level = 0.95, ci_args = NULL, ci_scale = "sd", show_cor = FALSE, digits = 3, ... ) # S3 method for glmmTMB extract_vc( model, ci_level = 0.95, ci_args = NULL, ci_scale = "sd", show_cor = FALSE, digits = 3, component = "cond", ... ) # S3 method for lme extract_vc( model, ci_level = 0.95, ci_args = NULL, ci_scale = "sd", show_cor = FALSE, digits = 3, ... ) # S3 method for brmsfit extract_vc( model, ci_level = 0.95, ci_args = NULL, ci_scale = "sd", show_cor = FALSE, digits = 3, component = NULL, ... ) # S3 method for stanreg extract_vc( model, ci_level = 0.95, ci_args = NULL, ci_scale = "sd", show_cor = FALSE, digits = 3, component = NULL, ... ) # S3 method for gam extract_vc( model, ci_level = 0.95, ci_args = NULL, ci_scale = "sd", show_cor = FALSE, digits = 3, ... ) extract_variance_components( model, ci_level = 0.95, ci_args = NULL, ci_scale = "sd", show_cor = FALSE, digits = 3, component = "cond", ... ) extract_VarCorr( model, ci_level = 0.95, ci_args = NULL, ci_scale = "sd", show_cor = FALSE, digits = 3, component = "cond", ... )
model  An lme4, glmmTMB, nlme, mgcv, or brms model. 

ci_level  Confidence level < 1, typically above 0.90. A value of 0 will
not report it (except for gam objects, which will revert to .95 due to

ci_args  Additional arguments to the corresponding confint method. 
ci_scale  A character string of 'sd' or 'var' to note the scale of the interval estimate. Default is 'sd'. at present. 
show_cor  Return the intercept/slope correlations as a separate list
element. Default is 
digits  Rounding. Default is 3. 
component  For glmmTMB objects, which of the three components 'cond' or
'zi' to select. Default is 'cond'. For brmsfit objects, this can filter
results to a certain part of the output, e.g. 'sigma' or 'zi' of
distributional models, or a specific outcome of a multivariate model. In
this case 
...  Other stuff to pass to the corresponding function. Unused/tested 
A data frame with output for variance components, or list that also contains the correlations of the random effects.
Returns a more usable (my opinion) version of variance components estimates including variance, standard deviation, the confidence interval for either, the relative proportion of variance, and all in a data frame with names that are clean and easy to use.
extract_variance_components
and extract_VarCorr
are aliases.
Right now, there are several issues with getting confidence intervals
for glmmTMB
objects
(for example). If
you get an error, you should check by running confint(my_tmb_model)
before
posting an issue. While I've attempted some minor hacks to deal with some
of them, if the glmmTMB
functionality doesn't work, this function won't
either.
lme4::confint.merMod()
,
lme4::VarCorr()
,
glmmTMB::VarCorr()
,
nlme::intervals()
,
nlme::VarCorr()
,
brms::VarCorr()
,
rstanarm::VarCorr()
,
mgcv::gam.vcomp()
Other extract:
extract_cor_structure()
,
extract_fixed_effects()
,
extract_het_var()
,
extract_model_data()
,
extract_random_coefs()
,
extract_random_effects()
library(lme4) library(mixedup) lmer_mod < lmer(Reaction ~ Days + (1 + Days  Subject), data = sleepstudy) extract_vc(lmer_mod)#>#> group effect variance sd sd_2.5 sd_97.5 #> sd_(Intercept)Subject Subject Intercept 612.100 24.741 14.381 37.716 #> sd_DaysSubject Subject Days 35.072 5.922 3.801 8.753 #> sigma Residual 654.940 25.592 22.898 28.858 #> var_prop #> sd_(Intercept)Subject 0.470 #> sd_DaysSubject 0.027 #> sigma 0.503extract_vc(lmer_mod, ci_scale = 'var')#>#> group effect variance sd var_2.5 var_97.5 #> sd_(Intercept)Subject Subject Intercept 612.100 24.741 206.825 1422.496 #> sd_DaysSubject Subject Days 35.072 5.922 14.449 76.621 #> sigma Residual 654.940 25.592 524.331 832.784 #> var_prop #> sd_(Intercept)Subject 0.470 #> sd_DaysSubject 0.027 #> sigma 0.503