modelCompare.merMod: Compare two lmer models

Description Usage Arguments Value References Examples

Description

This function provides fit statistics and effect sizes for model comparisons. The models must be nested.

Usage

1
2
## S3 method for class 'merMod'
modelCompare(model1, model2, ...)

Arguments

model1

A model estimated by lmer.

model2

A model estimated by lmer.

...

Additional arguments, not currently used but included to match generic.

Value

a data table with the fit indices for each model and comparing models to each other.

References

For estimating the marginal and conditional R-squared values, see: Nakagawa, S. and Schielzeth, H. (2013). A general and simple method for obtaining R2 from generalized linear mixed-effects models. Methods in Ecology and Evolution, 4(2), 133-142. as well as: Johnson, P. C. (2014). Extension of Nakagawa & Schielzeth's R2GLMM to random slopes models. Methods in Ecology and Evolution, 5(9), 944-946.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
library(JWileymisc)
data(aces_daily, package = "JWileymisc")
m1 <- lme4::lmer(PosAff ~ STRESS + (1 + STRESS | UserID),
  data = aces_daily)
m2 <- lme4::lmer(PosAff ~ STRESS + (1 | UserID),
  data = aces_daily)
m3 <- lme4::lmer(PosAff ~ STRESS + Female + (1 | UserID),
  data = aces_daily)

modelCompare(m1, m2)
modelCompare(m2, m3)

rm(m1, m2, m3)

multilevelTools documentation built on March 13, 2020, 2:07 a.m.