Description Usage Arguments Value Examples
Create mixed-effects regression formula from multi-level formulas from up to 3 levels.
1 2 | create_regeq(eq_lvl1, eq_lvl2, eq_lvl3 = NULL, cluster_lvl2,
cluster_lvl3 = NULL)
|
eq_lvl1 |
Regression equation for level-1 effects. |
eq_lvl2 |
List of regression equations for level-2 effects. |
eq_lvl3 |
List of regression equations for level-3 effects. |
cluster_lvl2 |
Name of grouping variable that defines level-2 clusters. |
cluster_lvl3 |
Name of grouping variable that defines level-3 clusters. |
A list containing (1) a mixed-effects equation, (2) a full level-1 equation, and (3) a level-1 equation for random effects only.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | ## Level-1 equation:
eq_lvl1 <- "outcome ~ x1_lvl1 + x2_lvl1"
## Level-2 equations:
eq_lvl2 <- list("outcome ~ x1_lvl2 + x2_lvl2",
"x1_lvl1 ~ x1_lvl2 + x2_lvl2",
"x2_lvl1 ~ 1")
## Level-3 equations:
eq_lvl3 <- list("outcome ~ x1_lvl3",
"x1_lvl2 ~ x1_lvl3",
"x2_lvl2 ~ 1")
## Clustering variables:
cluster_lvl2 <- "cluster2"
cluster_lvl3 <- "cluster3"
## Two-level model with no level-2 explanatory variables:
create_regeq(eq_lvl1 = eq_lvl1, eq_lvl2 = NULL,
cluster_lvl2 = cluster_lvl2)
## Two-level model with level-2 explanatory variables:
create_regeq(eq_lvl1 = eq_lvl1, eq_lvl2 = eq_lvl2,
cluster_lvl2 = cluster_lvl2)
## Three-level model:
create_regeq(eq_lvl1 = eq_lvl1, eq_lvl2 = eq_lvl2, eq_lvl3 = eq_lvl3,
cluster_lvl2 = cluster_lvl2, cluster_lvl3 = cluster_lvl3)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.