library(tidyverse)
## ── Attaching packages ─────────────────────────────────────── tidyverse 1.3.1 ──
## ✓ ggplot2 3.3.5     ✓ purrr   0.3.4
## ✓ tibble  3.1.4     ✓ dplyr   1.0.7
## ✓ tidyr   1.1.4     ✓ stringr 1.4.0
## ✓ readr   2.0.2     ✓ forcats 0.5.1
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## x dplyr::filter() masks stats::filter()
## x dplyr::lag()    masks stats::lag()
WVS <- readRDS(url("http://posc3410.svmiller.com/toy-data/wvs-trumpism.rds"))


M1 <- glm(sldummy ~ z_age + I(z_age^2) + female +
            hsedorless + z_ideo + z_incscale + gop + unemployed +
            + z_lemanc + gop*hsedorless,
          data=subset(WVS), family=binomial(link = "logit"))

summary(M1)
## 
## Call:
## glm(formula = sldummy ~ z_age + I(z_age^2) + female + hsedorless + 
##     z_ideo + z_incscale + gop + unemployed + +z_lemanc + gop * 
##     hsedorless, family = binomial(link = "logit"), data = subset(WVS))
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -1.6188  -0.8428  -0.6679   1.2282   2.2155  
## 
## Coefficients:
##                Estimate Std. Error z value Pr(>|z|)    
## (Intercept)    -1.10455    0.08964 -12.323  < 2e-16 ***
## z_age          -0.51725    0.07000  -7.390 1.47e-13 ***
## I(z_age^2)      0.18893    0.12957   1.458    0.145    
## female          0.07767    0.06871   1.130    0.258    
## hsedorless      0.43425    0.09166   4.738 2.16e-06 ***
## z_ideo          0.10459    0.07570   1.382    0.167    
## z_incscale      0.03924    0.07194   0.545    0.585    
## gop            -0.70920    0.12768  -5.555 2.78e-08 ***
## unemployed      0.63161    0.14021   4.505 6.65e-06 ***
## z_lemanc       -0.70974    0.07690  -9.229  < 2e-16 ***
## hsedorless:gop  0.19036    0.14931   1.275    0.202    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 5452.0  on 4555  degrees of freedom
## Residual deviance: 5165.7  on 4545  degrees of freedom
##   (1667 observations deleted due to missingness)
## AIC: 5187.7
## 
## Number of Fisher Scoring iterations: 4
M2 <- glm(sldummy ~ z_age + I(z_age^2) + female +
            hsedorless + z_ideo + z_incscale + gop + unemployed +
            + z_lemanc + gop*hsedorless,
          data=subset(WVS, year == 2011), family=binomial(link = "logit"))

summary(M2)
## 
## Call:
## glm(formula = sldummy ~ z_age + I(z_age^2) + female + hsedorless + 
##     z_ideo + z_incscale + gop + unemployed + +z_lemanc + gop * 
##     hsedorless, family = binomial(link = "logit"), data = subset(WVS, 
##     year == 2011))
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -1.7358  -0.8387  -0.6113   1.0793   2.4409  
## 
## Coefficients:
##                Estimate Std. Error z value Pr(>|z|)    
## (Intercept)     -0.8904     0.1510  -5.897 3.69e-09 ***
## z_age           -0.7274     0.1312  -5.545 2.94e-08 ***
## I(z_age^2)       0.1981     0.2414   0.821  0.41192    
## female           0.2979     0.1304   2.284  0.02236 *  
## hsedorless       0.4919     0.1748   2.814  0.00489 ** 
## z_ideo           0.2938     0.1520   1.933  0.05325 .  
## z_incscale       0.2846     0.1390   2.047  0.04066 *  
## gop             -1.2820     0.2135  -6.006 1.90e-09 ***
## unemployed       0.3889     0.2514   1.547  0.12179    
## z_lemanc        -0.7445     0.1491  -4.992 5.98e-07 ***
## hsedorless:gop   0.5298     0.2715   1.951  0.05102 .  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 1594.4  on 1315  degrees of freedom
## Residual deviance: 1451.0  on 1305  degrees of freedom
##   (916 observations deleted due to missingness)
## AIC: 1473
## 
## Number of Fisher Scoring iterations: 4
M3 <- glm(hddummy ~ z_age + I(z_age^2) + female +
            hsedorless + z_ideo + z_incscale + gop + unemployed +
            + z_lemanc + gop*hsedorless,
          data=subset(WVS), family=binomial(link = "logit"))

summary(M3)
## 
## Call:
## glm(formula = hddummy ~ z_age + I(z_age^2) + female + hsedorless + 
##     z_ideo + z_incscale + gop + unemployed + +z_lemanc + gop * 
##     hsedorless, family = binomial(link = "logit"), data = subset(WVS))
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -1.2720  -0.5356  -0.4094  -0.2944   2.7780  
## 
## Coefficients:
##                Estimate Std. Error z value Pr(>|z|)    
## (Intercept)    -3.12609    0.16280 -19.202  < 2e-16 ***
## z_age          -0.70239    0.10038  -6.998 2.60e-12 ***
## I(z_age^2)     -0.07885    0.19133  -0.412 0.680255    
## female          0.39329    0.09871   3.984 6.76e-05 ***
## hsedorless      0.73733    0.16448   4.483 7.37e-06 ***
## z_ideo         -0.13744    0.10687  -1.286 0.198413    
## z_incscale     -0.35873    0.10294  -3.485 0.000493 ***
## gop             0.74117    0.19538   3.793 0.000149 ***
## unemployed      0.57488    0.17634   3.260 0.001114 ** 
## z_lemanc       -0.66234    0.10968  -6.039 1.55e-09 ***
## hsedorless:gop -0.13862    0.21839  -0.635 0.525618    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 3190.0  on 4520  degrees of freedom
## Residual deviance: 2960.5  on 4510  degrees of freedom
##   (1702 observations deleted due to missingness)
## AIC: 2982.5
## 
## Number of Fisher Scoring iterations: 5