View source: R/lvl2_var_cond_lvl1.R
lvl2_var_cond_lvl1 | R Documentation |
Variance between level 2 units at different values of level 1 variables.
lvl2_var_cond_lvl1(model, lvl1.var, lvl1.values)
model |
Mixed effect model fitted with lmer. Must include random intercept, slope, and their covariation. |
lvl1.var |
Level 1 variable name. |
lvl1.values |
Level 1 variable values. |
Data frame of level 2 variance estimates conditioned on level 1 variable values.
cdat <- group_mean_center( data = iris, vars = c( "Sepal.Length", "Sepal.Width", "Petal.Length", "Petal.Width" ), group.var = "Species", grand.init = TRUE ) fit <- lme4::lmer(Sepal.Length ~ Petal.Length.gmc + (Petal.Length.gmc | Species), data = cdat, REML = FALSE ) lvl2_var_cond_lvl1( model = fit, lvl1.var = "Petal.Length.gmc", lvl1.values = c(-2, -1, 0, 1, 2) )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.