View source: R/extract_random_effects.R
| extract_random_effects | R Documentation |
Extracts the random effects and their standard errors.
extract_random_effects( model, re = NULL, ci_level = 0.95, digits = 3, add_group_N = FALSE, ... ) ## S3 method for class 'merMod' extract_random_effects( model, re = NULL, ci_level = 0.95, digits = 3, add_group_N = FALSE, condvar = TRUE, ... ) ## S3 method for class 'glmmTMB' extract_random_effects( model, re = NULL, ci_level = 0.95, digits = 3, add_group_N = FALSE, component = "cond", condvar = TRUE, ... ) ## S3 method for class 'lme' extract_random_effects( model, re = NULL, ci_level = NULL, digits = 3, add_group_N = FALSE, ... ) ## S3 method for class 'brmsfit' extract_random_effects( model, re = NULL, ci_level = 0.95, digits = 3, add_group_N = FALSE, component = NULL, ... ) ## S3 method for class 'stanreg' extract_random_effects( model, re = NULL, ci_level = 0.95, digits = 3, add_group_N = FALSE, component = NULL, ... ) ## S3 method for class 'gam' extract_random_effects( model, re = NULL, ci_level = 0.95, digits = 3, add_group_N = FALSE, ... ) extract_ranef( model, re = NULL, ci_level = 0.95, digits = 3, add_group_N = FALSE, ... )
model |
An appropriate model. See details. |
re |
The name of the grouping variable for the random effects. Default
is |
ci_level |
Where possible, confidence level < 1, typically above 0.90. A value of 0 will not report it. Default is .95. Not applicable to nlme objects. |
digits |
Rounding. Default is 3. |
add_group_N |
Add group sample sizes to output? Default is |
... |
Other arguments specific to the method. Unused at present. |
condvar |
Include conditional variance. Used in |
component |
For |
Relative to ranef for the various packages, this just adds the
standard errors and cluster ids as columns, and uncertainty intervals.
Current models supported:
data frame of the random effects
The nlme package only provides the estimated random effect parameters, not their uncertainty, so it isn't provided.
merMod and glmmTMB objects results are based on the estimated
conditional variances, i.e. condvar = TRUE. This is likely an
underestimate relative to brms results.
For mgcv, the Vp (Bayesian) estimated variance covariance matrix is
used.
lme4::ranef(),
glmmTMB::ranef(),
nlme::ranef(),
brms::ranef(),
rstanarm::ranef(),
mgcv::gamObject(),
mgcv::smooth.construct.re.smooth.spec()
Other extract:
extract_cor_structure(),
extract_fixed_effects(),
extract_het_var(),
extract_model_data(),
extract_random_coefs(),
extract_vc()
library(lme4) library(mixedup) lmer_model <- lmer(Reaction ~ Days + (1 + Days | Subject), data = sleepstudy) extract_random_effects(lmer_model)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.