variance_reduction: Explained variance for two-level random intercept models

Description Usage Arguments Value Examples

View source: R/variance_reduction.r

Description

Function to compute the amount explained variance on each level by a random-intercept multilevel model. The amount of explained variance is computed by comparing the relevant models to the baseline (null-) model (i.e., the bare random-intercept model without any predictors).

Usage

1
variance_reduction(object, ..., digits = 2, print = FALSE)

Arguments

object

An object of class merMod (more specifically, an object of subclass lmerMod). This first object needs to be the null model with no predictors. All other models will be compared to this baseline model.

...

Up to four objects of class merMod.

red

A logical value indicating wether only the explained variance should be reported (defaults to TRUE).

Value

A data fram containing the explained variance on both levels.

Examples

1
2
3
4
m0 <- lme4::lmer(Reaction ~ 1 + (1 | Subject), sleepstudy)
m1 <- lme4::lmer(Reaction ~ 1 + Days + (1 | Subject), sleepstudy)

variance_reduction(m0, m1, print = T, digits = 3)

masurp/pmstats documentation built on Oct. 6, 2020, 9:24 p.m.