Description Usage Arguments Details Value See Also Examples

`r2mlm`

reads in a multilevel model (MLM) object generated using
`lmer`

or `nlme`

, and outputs all
relevant R-squared measures from the Rights and Sterba (2019) framework of
multilevel model R-squared measures, which can be visualized together as a
set using the outputted bar chart decompositions of outcome variance. That is,
when predictors are cluster-mean-centered, all R-squared measures from Rights
& Sterba (2019) Table 1 and decompositions from Rights & Sterba (2019) Figure
1 are outputted. When predictors are not cluster-mean-centered, the total
R-squared measures from Rights & Sterba (2019) Table 5, as well as bar chart
decompositions are outputted. Any number of level-1 and/or level-2 predictors
is supported. Any of the level-1 predictors can have random slopes.

1 |

`model` |
A model generated using |

`bargraph` |
Optional bar graph output, default is TRUE. |

`r2mlm`

first determines whether a given model was generated using
`lmer`

or `nlme`

, then passes the model
to helper functions that pull the raw data and parameter estimates from the
model, and pass that information to `r2mlm_manual`

.

If the input is a valid model, then the output will be a list and associated graphical representation of R-squared decompositions. If the model is not valid, it will return an error prompting the user to input a valid model.

Rights, J. D., & Sterba, S. K. (2019). Quantifying explained variance in multilevel models: An integrative framework for defining R-squared measures. Psychological Methods, 24(3), 309–338. <doi:10.1037/met0000184>

Other r2mlm single model functions:
`r2mlm3_manual()`

,
`r2mlm_long_manual()`

,
`r2mlm_manual()`

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | ```
# Using lme4 for your model
# The "bobyqa" optimizer is required for this particular model to converge
model_lme4 <- lmer(satisfaction ~ 1 + salary_c + control_c + salary_m + control_m +
s_t_ratio + (1 + salary_c + control_c| schoolID), data = teachsat, REML =
TRUE, control = lmerControl(optimizer = "bobyqa"))
r2mlm(model_lme4)
# Using nlme for your model
model_nlme <- lme(satisfaction ~ 1 + salary_c + control_c + salary_m +
control_m + s_t_ratio,
random = ~ 1 + salary_c + control_c | schoolID,
data = teachsat,
method = "REML",
control = lmeControl(opt = "optim"))
r2mlm(model_nlme)
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.