library(effects) ## load the effects package
data(Cowles)
mod.cowles <- glm(volunteer ~ sex + neuroticism * extraversion, data = Cowles, family = binomial)
summary(mod.cowles)
##
## Call:
## glm(formula = volunteer ~ sex + neuroticism * extraversion, family = binomial,
## data = Cowles)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -1.475 -1.060 -0.893 1.261 1.998
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -2.35821 0.50132 -4.70 2.6e-06 ***
## sexmale -0.24715 0.11163 -2.21 0.0268 *
## neuroticism 0.11078 0.03765 2.94 0.0033 **
## extraversion 0.16682 0.03772 4.42 9.7e-06 ***
## neuroticism:extraversion -0.00855 0.00293 -2.92 0.0036 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 1933.5 on 1420 degrees of freedom
## Residual deviance: 1897.4 on 1416 degrees of freedom
## AIC: 1907
##
## Number of Fisher Scoring iterations: 4
eff.cowles <- allEffects(mod.cowles, xlevels = list(neuroticism = seq(0, 24, 6), extraversion = seq(0,
24, 8)))
plot(eff.cowles, "neuroticism:extraversion", ylab = "Prob(Volunteer)", ticks = list(at = c(0.1,
0.25, 0.5, 0.75, 0.9)), layout = c(4, 1), aspect = 1)