library(effects) # for Arrests data
library(car) # for Anova()
data(Arrests)
Arrests$year <- as.factor(Arrests$year)
arrests.mod <- glm(released ~ employed + citizen + checks + colour * year + colour * age, family = binomial,
data = Arrests)
Anova(arrests.mod)
## Analysis of Deviance Table (Type II tests)
##
## Response: released
## LR Chisq Df Pr(>Chisq)
## employed 72.7 1 < 2e-16 ***
## citizen 25.8 1 3.8e-07 ***
## checks 205.2 1 < 2e-16 ***
## colour 19.6 1 9.7e-06 ***
## year 6.1 5 0.29785
## age 0.5 1 0.49827
## colour:year 21.7 5 0.00059 ***
## colour:age 13.9 1 0.00019 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
# Plot 3-way effect (not in model)
plot(effect("colour:year:age", arrests.mod, xlevels = list(age = 15:45)), multiline = TRUE,
ylab = "Probability(released)", rug = FALSE)