get_anova.Rd
This function obtains the ANOVA table for a model.
get_anova(model, type = "III", ..., info = FALSE, suppressWarnings = TRUE)
a fitted model object. Supported classes: "lm"
, "lmerModLmerTest"
, "glmmTMB"
, "gls"
, "lme"
.
Type of ANOVA test: "I"
, "II"
or "III"
(default).
additional arguments to be passed to the specific anova function.
Logical, if TRUE
, information about the type of ANOVA and
test statistic used is printed to the console. Default is FALSE
.
Logical; if TRUE
, suppresses warnings from car::Anova()
. Default is TRUE.
The function utilizes car::Anova()
for all supported model
classes and defaults to type III of sum of squares. For models of class
'lm' and 'lmerModLmerTest', the F-test is employed. In contrast, for models of the
'glmmTMB', 'gls', and 'lme' class, the Chi-Square test is used since the
F-test is
currently
unavailable. It's worth noting that only the 'lmerModLmerTest' models support (and
default to) the Kenward-Roger method as a degrees of freedom method.
lm
(Package: stats): Types I/II/III; F-Test; Standard df.
lmer/lmerTest
(Packages: lme4/lmerTest): Types I/II/III; F-Test; Kenward-Roger (KR) df.
lme
(Package: nlme): Types I/II/III; Chi-Square Test (Chisq*); Standard df.
gls
(Package: nlme): Types I/II/III; Chi-Square Test (Chisq*); Standard df.
glmmTMB
(Package: glmmTMB): Types I/II/III; Chi-Square Test; Standard df.
You can obtain the F-Test only for type I/II via stats::anova()
The type
argument specifies the type of sum of squares to be used in the analysis:
Type I (Sequential) sum of squares: The order in which factors are entered into the model does matter. Each factor is adjusted for the factors listed before it.
Type II (Marginal) sum of squares: The order in which factors are entered into the model does not matter. Each factor is adjusted for all of the other factors in the model.
Type III sum of squares: The order in which factors are entered into the model does not matter, similar to Type II. However, each factor is adjusted for all of the other factors as well as for itself, which allows for the testing of each factor in the presence of interactions.
Kenward-Roger Degrees of Freedom: The Kenward-Roger (KR) method is a sophisticated approach to approximating the degrees of freedom in mixed models, particularly in the presence of small sample sizes or unbalanced data. It is not applicable to non-mixed models. Unlike the classical degrees of freedom methods which may overestimate the significance of effects, the KR approximation tends to provide a more conservative and accurate estimation. This method adjusts the degrees of freedom to account for the complexity of the mixed model structure, thereby enhancing the robustness of the resulting inference. The Kenward-Roger method is especially beneficial when working with complex models that include multiple random effects and/or nested structures, as it helps to mitigate the risk of Type I errors, offering a more reliable foundation for hypothesis testing. Importantly, employing the KR method is never disadvantageous when compared to using the default method; it provides a more accurate reflection of the model's complexity and the data structure, thus leading to more reliable statistical inferences.