format model comparison metrics in APA style
Arguments
- ...
model fit objects, or a list of them. Models are labeled by the list's names (or the argument names), and "Model 1", "Model 2", ... for unnamed models.
- metrics
performance metrics. If
NULL(default), R2, deltaR2, F, and p for models with an estimated dispersion parameter (e.g.,lm, Gaussian or quasi-familyglm), and R2, deltaR2, Chi2, df, and p for GLMs with a fixed dispersion parameter (binomial, Poisson, negative binomial). Use "all" for all available metrics.- starred
columns to star with significant p_values
- column_formats
column_formats object to format columns. If NULL, the default column_formats is used.
Details
Nested models are compared with F tests (performance::test_wald()) unless every model is a GLM with a fixed dispersion parameter, in which case likelihood ratio tests (performance::test_likelihoodratio()) are used. For GLMs, R2 is the pseudo-R^2^ that performance::r2() selects for the model family, and the header names it (e.g., R^2^~Tjur~).
Mixed models (lme4::lmer and lme4::glmer) are compared with likelihood ratio tests. R2 is the marginal R^2^ (variance explained by the fixed effects), and by default the conditional R^2^ (fixed and random effects) and its change (R2_conditional, deltaR2_conditional) are shown too, because adding random effects changes the conditional but not the marginal R^2^.
Examples
m1 <- lm(mpg ~ cyl, data = mtcars)
m2 <- lm(mpg ~ cyl + wt, data = mtcars)
apa_performance_comparison(list(`Model 1` =m1, `Model 3` =m2)) |>
apa_flextable()
Model
R2
ΔR2
F
p
Model 1
.73
.73
Model 3
.83
.10
17.77
<.001