Calculate ANOVA tables for linear models. If no anovatype
argument is provided, a type III ANOVA will be calculated. Type I and II are also supported for compatibility. Support for mixed models and a more convenient way to create ANOVAs (similar to the ez
package in R) is planned.
Important: Make sure to use EffectsCoding
on all your predictors, or results won't be meaningful.
Minimal Example:
using RDatasets, GLM, ANOVA
data = dataset("datasets", "ToothGrowth")
categorical!(data, :Dose)
model = fit(LinearModel,
@formula(Len ~ Supp + Dose),
data,
contrasts = Dict(:Supp => EffectsCoding(), :Dose => EffectsCoding()))
Anova(model)
ANOVA table for linear model
DF SS MSS F p
Supp 1.0 205.35 205.35 14.0166 0.0004
Dose 2.0 2426.43 1213.22 82.8109 <1e-16
Residuals 56.0 820.425 14.6504 0.0 <1e-99