Load packages and data

library(effects)   ## load the effects package
library(car)       ## for Anova: type II tests
data(Cowles, package = "carData")

Main effects model

mod.cowles0 <- glm(volunteer ~ sex + neuroticism + extraversion, 
    data=Cowles, family=binomial)
summary(mod.cowles0)
## 
## Call:
## glm(formula = volunteer ~ sex + neuroticism + extraversion, family = binomial, 
##     data = Cowles)
## 
## Deviance Residuals: 
##    Min      1Q  Median      3Q     Max  
## -1.398  -1.045  -0.908   1.260   1.685  
## 
## Coefficients:
##              Estimate Std. Error z value Pr(>|z|)    
## (Intercept)  -1.11650    0.24906   -4.48  7.4e-06 ***
## sexmale      -0.23516    0.11118   -2.12    0.034 *  
## neuroticism   0.00636    0.01136    0.56    0.575    
## extraversion  0.06633    0.01426    4.65  3.3e-06 ***
## ---
## 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: 1906.1  on 1417  degrees of freedom
## AIC: 1914
## 
## Number of Fisher Scoring iterations: 4
Anova(mod.cowles0)
## Analysis of Deviance Table (Type II tests)
## 
## Response: volunteer
##              LR Chisq Df Pr(>Chisq)    
## sex              4.49  1      0.034 *  
## neuroticism      0.31  1      0.575    
## extraversion    22.14  1    2.5e-06 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Test all interactions

mod.cowles1 <- glm(volunteer ~ (sex + neuroticism + extraversion)^2, 
    data=Cowles, family=binomial)
summary(mod.cowles1)
## 
## Call:
## glm(formula = volunteer ~ (sex + neuroticism + extraversion)^2, 
##     family = binomial, data = Cowles)
## 
## Deviance Residuals: 
##    Min      1Q  Median      3Q     Max  
## -1.498  -1.054  -0.896   1.260   1.967  
## 
## Coefficients:
##                          Estimate Std. Error z value Pr(>|z|)    
## (Intercept)              -2.49818    0.57555   -4.34  1.4e-05 ***
## sexmale                  -0.02198    0.49187   -0.04   0.9644    
## neuroticism               0.11545    0.03937    2.93   0.0034 ** 
## extraversion              0.17650    0.04273    4.13  3.6e-05 ***
## sexmale:neuroticism      -0.00368    0.02302   -0.16   0.8730    
## sexmale:extraversion     -0.01466    0.02938   -0.50   0.6178    
## neuroticism:extraversion -0.00881    0.00299   -2.95   0.0032 ** 
## ---
## 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.2  on 1414  degrees of freedom
## AIC: 1911
## 
## Number of Fisher Scoring iterations: 4
Anova(mod.cowles1)
## Analysis of Deviance Table (Type II tests)
## 
## Response: volunteer
##                          LR Chisq Df Pr(>Chisq)    
## sex                          4.92  1      0.027 *  
## neuroticism                  0.31  1      0.575    
## extraversion                22.10  1    2.6e-06 ***
## sex:neuroticism              0.03  1      0.873    
## sex:extraversion             0.25  1      0.618    
## neuroticism:extraversion     8.81  1      0.003 ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Add one interaction

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
anova(mod.cowles0, mod.cowles, mod.cowles1)
## Analysis of Deviance Table
## 
## Model 1: volunteer ~ sex + neuroticism + extraversion
## Model 2: volunteer ~ sex + neuroticism * extraversion
## Model 3: volunteer ~ (sex + neuroticism + extraversion)^2
##   Resid. Df Resid. Dev Df Deviance
## 1      1417       1906            
## 2      1416       1897  1     8.62
## 3      1414       1897  2     0.26
IycgLS0tDQojJyB0aXRsZTogIkNvd2xlcyBkYXRhOiBMb2dpc3RpYyByZWdyZXNzaW9uIg0KIycgYXV0aG9yOiAiTWljaGFlbCBGcmllbmRseSINCiMnIGRhdGU6ICJgciBmb3JtYXQoU3lzLkRhdGUoKSlgIg0KIycgb3V0cHV0Og0KIycgICBodG1sX2RvY3VtZW50Og0KIycgICAgIHRoZW1lOiByZWFkYWJsZQ0KIycgICAgIGNvZGVfZG93bmxvYWQ6IHRydWUNCiMnIC0tLQ0KDQojKyBlY2hvPUZBTFNFDQprbml0cjo6b3B0c19jaHVuayRzZXQoDQogIHdhcm5pbmcgPSBGQUxTRSwgICAjIGF2b2lkIHdhcm5pbmdzIGFuZCBtZXNzYWdlcyBpbiB0aGUgb3V0cHV0DQogIG1lc3NhZ2UgPSBGQUxTRQ0KKQ0KDQojJyAjIyBMb2FkIHBhY2thZ2VzIGFuZCBkYXRhDQpsaWJyYXJ5KGVmZmVjdHMpICAgIyMgbG9hZCB0aGUgZWZmZWN0cyBwYWNrYWdlDQpsaWJyYXJ5KGNhcikgICAgICAgIyMgZm9yIEFub3ZhOiB0eXBlIElJIHRlc3RzDQpkYXRhKENvd2xlcywgcGFja2FnZSA9ICJjYXJEYXRhIikNCg0KIycgIyMgTWFpbiBlZmZlY3RzIG1vZGVsDQptb2QuY293bGVzMCA8LSBnbG0odm9sdW50ZWVyIH4gc2V4ICsgbmV1c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