mlm_assumptions: Reports the output of testing all assumptions for a...

View source: R/mlm_assumptions.R

mlm_assumptionsR Documentation

Reports the output of testing all assumptions for a multilevel model

Description

Reports the results from testing all assumptions of a multilevel model and provides suggestions if an assumption is not passed

Usage

mlm_assumptions(model, re_type = c("NA"))

Arguments

model

A linear mixed-effects model of class lmerMod, lmerModLmerTest, or glmerMod of type binomial.

re_type

A value indicating whether a model with two random effects is nested or cross-classified

Value

If re_type is "NA", the proportion of variance at the random effect is computed.

If re_type = "nested", the likeness of y scores in the same level 3 unit (the proportion of variance at Level3_factor), the likeness of y scores in the same level 2 units in the same level 3 unit (proportion of variance at Level3_factor and Level2_factor), and the likeness of level 2 units in the same level 3 unit (proportion of Level2_factor variance at Level3_factor) are computed.

If re_type = "cc", the likeness of y scores in the same C1_factor unit (correlation between outcome values of units in same C1_factor but different C2_factor), the likeness of y scores in the same C2_factor (correlation between outcome values of units in the same C2_factor but different C2_factor), and the likeness of y scores in the same C1_factor and C2_factor combination (correlation between outcome values of units in the same C2_factor and C2_factor) are computed.

Tests the relevant assumptions of the specified multilevel model.

References

Glaser, R. E. (2006). Levene’s Robust Test of Homogeneity of Variances. Encyclopedia of Statistical Sciences. 6.

Examples

# Gaussian
## Read in data
data(instruction)
## Create model
mod <- lme4::lmer(mathgain ~ mathkind + (1 | classid), data = instruction)
## Evaluate assumptions
mlm_assumptions(mod)

# Logistic
## Read in data
data(reporting)
## Create model
mod <- lme4::glmer(mention.outliers ~ Basics + (1 | Journal), data = reporting, family = "binomial")
## Evaluate assumptions
mlm_assumptions(mod)


lj5yn/mlmtools documentation built on March 10, 2023, 8:37 p.m.