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.3977  -1.0454  -0.9084   1.2601   1.6849  
## 
## Coefficients:
##               Estimate Std. Error z value Pr(>|z|)    
## (Intercept)  -1.116496   0.249057  -4.483 7.36e-06 ***
## sexmale      -0.235161   0.111185  -2.115   0.0344 *  
## neuroticism   0.006362   0.011357   0.560   0.5754    
## extraversion  0.066325   0.014260   4.651 3.30e-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.1
## 
## 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.4861  1    0.03417 *  
## neuroticism    0.3139  1    0.57532    
## extraversion  22.1372  1  2.538e-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.4981  -1.0545  -0.8958   1.2597   1.9670  
## 
## Coefficients:
##                           Estimate Std. Error z value Pr(>|z|)    
## (Intercept)              -2.498183   0.575546  -4.341 1.42e-05 ***
## sexmale                  -0.021976   0.491866  -0.045  0.96436    
## neuroticism               0.115450   0.039370   2.932  0.00336 ** 
## extraversion              0.176503   0.042725   4.131 3.61e-05 ***
## sexmale:neuroticism      -0.003680   0.023020  -0.160  0.87300    
## sexmale:extraversion     -0.014661   0.029381  -0.499  0.61778    
## neuroticism:extraversion -0.008809   0.002987  -2.949  0.00319 ** 
## ---
## 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.2
## 
## 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.9184  1   0.026572 *  
## neuroticism                0.3150  1   0.574642    
## extraversion              22.1016  1  2.586e-06 ***
## sex:neuroticism            0.0256  1   0.873001    
## sex:extraversion           0.2491  1   0.617718    
## neuroticism:extraversion   8.8117  1   0.002993 ** 
## ---
## 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.4749  -1.0602  -0.8934   1.2609   1.9978  
## 
## Coefficients:
##                           Estimate Std. Error z value Pr(>|z|)    
## (Intercept)              -2.358207   0.501320  -4.704 2.55e-06 ***
## sexmale                  -0.247152   0.111631  -2.214  0.02683 *  
## neuroticism               0.110777   0.037648   2.942  0.00326 ** 
## extraversion              0.166816   0.037719   4.423 9.75e-06 ***
## neuroticism:extraversion -0.008552   0.002934  -2.915  0.00355 ** 
## ---
## 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.4
## 
## 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.1            
## 2      1416     1897.4  1   8.6213
## 3      1414     1897.2  2   0.2579
IycgLS0tDQojJyB0aXRsZTogIkNvd2xlcyBkYXRhOiBMb2dpc3RpYyByZWdyZXNzaW9uIg0KIycgYXV0aG9yOiAiTWljaGFlbCBGcmllbmRseSINCiMnIGRhdGU6ICJgciBmb3JtYXQoU3lzLkRhdGUoKSlgIg0KIycgb3V0cHV0Og0KIycgICBodG1sX2RvY3VtZW50Og0KIycgICAgIHRoZW1lOiByZWFkYWJsZQ0KIycgICAgIGNvZGVfZG93bmxvYWQ6IHRydWUNCiMnIC0tLQ0KDQpsaWJyYXJ5KGVmZmVjdHMpICAgIyMgbG9hZCB0aGUgZWZmZWN0cyBwYWNrYWdlDQpsaWJyYXJ5KGNhcikgICAgICAgIyMgZm9yIEFub3ZhOiB0eXBlIElJIHRlc3RzDQpkYXRhKENvd2xlcywgcGFja2FnZSA9ICJjYXJEYXRhIikNCg0KIycgIyMgTWFpbiBlZmZlY3RzIG1vZGVsDQptb2QuY293bGVzMCA8LSBnbG0odm9sdW50ZWVyIH4gc2V4ICsgbmV1cm90aWNpc20gKyBleHRyYXZlcnNpb24sIA0KICAgIGRhdGE9Q293bGVzLCBmYW1pbHk9Ymlub21pYWwpDQpzdW1tYXJ5KG1vZC5jb3dsZXMwKQ0KQW5vdmEobW9kLmNvd2xlczApDQoNCg0KIycgIyMgVGVzdCBhbGwgaW50ZXJhY3Rp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