GLMs. Generalized logistic regression models (Agresti, 2007)
Additive models. Prediction for use of face mask by combinations of
factors
Age + Gender + Decree
##
## Call:
## glm(formula = mask ~ Decree + ageclass + Gender, family = binomial,
## data = mask2)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -1.9275 -1.0046 0.5825 0.7779 1.6719
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -0.008761 0.096503 -0.091 0.9277
## Decreepost 1.696804 0.099457 17.061 <2e-16 ***
## ageclassage1 -0.692747 0.252131 -2.748 0.0060 **
## ageclassage2 -0.235467 0.173846 -1.354 0.1756
## ageclassage4 -0.108664 0.162065 -0.670 0.5025
## Gendermales -0.412245 0.105991 -3.889 0.0001 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 2921.5 on 2157 degrees of freedom
## Residual deviance: 2569.5 on 2152 degrees of freedom
## AIC: 2581.5
##
## Number of Fisher Scoring iterations: 4
Age + Gender
##
## Call:
## glm(formula = mask ~ ageclass + Gender, family = binomial, data = mask2)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -1.4712 -1.3335 0.9097 1.0290 1.2368
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 0.66837 0.08483 7.879 3.3e-15 ***
## ageclassage1 -0.49828 0.23119 -2.155 0.03114 *
## ageclassage2 -0.44659 0.16184 -2.759 0.00579 **
## ageclassage4 -0.32598 0.14932 -2.183 0.02903 *
## Gendermales -0.30873 0.09796 -3.152 0.00162 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 2921.5 on 2157 degrees of freedom
## Residual deviance: 2895.2 on 2153 degrees of freedom
## AIC: 2905.2
##
## Number of Fisher Scoring iterations: 4
Gender + Decree
##
## Call:
## glm(formula = mask ~ Decree + Gender, family = binomial, data = mask2)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -1.9035 -0.9826 0.5973 0.7198 1.3856
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -0.06226 0.09370 -0.664 0.506
## Decreepost 1.69542 0.09851 17.210 < 2e-16 ***
## Gendermales -0.41487 0.10522 -3.943 8.05e-05 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 2921.5 on 2157 degrees of freedom
## Residual deviance: 2578.5 on 2155 degrees of freedom
## AIC: 2584.5
##
## Number of Fisher Scoring iterations: 4
Age + Decree
##
## Call:
## glm(formula = mask ~ Decree + ageclass, family = binomial, data = mask2)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -1.7960 -1.0595 0.6668 0.7534 1.5981
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -0.28371 0.06586 -4.308 1.65e-05 ***
## Decreepost 1.67417 0.09872 16.959 < 2e-16 ***
## ageclassage1 -0.66637 0.25120 -2.653 0.00798 **
## ageclassage2 -0.27619 0.17375 -1.590 0.11194
## ageclassage4 -0.15843 0.16023 -0.989 0.32280
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 2921.5 on 2157 degrees of freedom
## Residual deviance: 2584.8 on 2153 degrees of freedom
## AIC: 2594.8
##
## Number of Fisher Scoring iterations: 4
Delta AICs Table
| Global |
0.00 |
| Without.Decree |
-323.69 |
| Without.Age |
-3.02 |
| Without.Gender |
-13.34 |
ORs table for global additive model (intercepts not included)
## Variable Lower Odds Ratio Upper
## 1 Post-Decree 4.5 5.5 6.6
## 2 Children 0.3 0.5 0.8
## 3 Juveniles 0.6 0.8 1.1
## 4 Elders 0.7 0.9 1.2
## 5 Males 0.5 0.7 0.8
Interaction model
##
## Call:
## glm(formula = mask ~ Decree * ageclass * Gender, family = binomial,
## data = mask2)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -2.0782 -1.0028 0.6039 0.6934 1.7214
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 2.112e-14 1.183e-01 0.000 1.00000
## Decreepost 1.609e+00 2.063e-01 7.802 6.11e-15 ***
## ageclassage1 -5.878e-01 5.702e-01 -1.031 0.30259
## ageclassage2 -2.683e-01 3.870e-01 -0.693 0.48814
## ageclassage4 1.163e+00 5.258e-01 2.212 0.02696 *
## Gendermales -4.256e-01 1.455e-01 -2.924 0.00345 **
## Decreepost:ageclassage1 -6.162e-01 7.946e-01 -0.775 0.43808
## Decreepost:ageclassage2 -1.747e+00 1.006e+00 -1.737 0.08246 .
## Decreepost:ageclassage4 -1.269e+00 7.814e-01 -1.623 0.10452
## Decreepost:Gendermales 1.190e-01 2.448e-01 0.486 0.62679
## ageclassage1:Gendermales -2.104e-01 7.688e-01 -0.274 0.78431
## ageclassage2:Gendermales -2.650e-01 4.659e-01 -0.569 0.56945
## ageclassage4:Gendermales -1.287e+00 5.676e-01 -2.267 0.02339 *
## Decreepost:ageclassage1:Gendermales 1.028e+00 1.040e+00 0.988 0.32326
## Decreepost:ageclassage2:Gendermales 3.014e+00 1.130e+00 2.667 0.00766 **
## Decreepost:ageclassage4:Gendermales 7.217e-01 8.698e-01 0.830 0.40670
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 2921.5 on 2157 degrees of freedom
## Residual deviance: 2544.4 on 2142 degrees of freedom
## AIC: 2576.4
##
## Number of Fisher Scoring iterations: 4
Generalized Logistic MIXED Model
Decree as Random effect
## Generalized linear mixed model fit by maximum likelihood (Laplace
## Approximation) [glmerMod]
## Family: binomial ( logit )
## Formula: Y ~ Gender * ageclass + (1 | Decree)
## Data: mask
##
## AIC BIC logLik deviance df.resid
## 115.7 122.7 -48.9 97.7 7
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -1.8882 -0.7442 -0.0418 0.6617 2.2326
##
## Random effects:
## Groups Name Variance Std.Dev.
## Decree (Intercept) 0.7065 0.8406
## Number of obs: 16, groups: Decree, 2
##
## Fixed effects:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 0.8169 0.6026 1.356 0.17521
## Gendermales -0.3822 0.1172 -3.260 0.00111 **
## ageclassage1 -0.9308 0.4167 -2.234 0.02548 *
## ageclassage2 -0.4979 0.3690 -1.350 0.17716
## ageclassage4 0.6969 0.4059 1.717 0.08601 .
## Gendermales:ageclassage1 0.3839 0.5214 0.736 0.46156
## Gendermales:ageclassage2 0.3294 0.4179 0.788 0.43061
## Gendermales:ageclassage4 -0.9866 0.4448 -2.218 0.02656 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) Gndrml agcls1 agcls2 agcls4 Gndr:1 Gndr:2
## Gendermales -0.137
## ageclassag1 -0.039 0.198
## ageclassag2 -0.041 0.215 0.059
## ageclassag4 -0.038 0.198 0.055 0.064
## Gndrmls:gc1 0.030 -0.224 -0.797 -0.049 -0.045
## Gndrmls:gc2 0.037 -0.276 -0.053 -0.882 -0.056 0.062
## Gndrmls:gc4 0.036 -0.263 -0.052 -0.057 -0.912 0.059 0.073
Gender as random effect
## Generalized linear mixed model fit by maximum likelihood (Laplace
## Approximation) [glmerMod]
## Family: binomial ( logit )
## Formula: Y ~ Decree * ageclass + (1 | Gender)
## Data: mask
##
## AIC BIC logLik deviance df.resid
## 109.3 116.3 -45.7 91.3 7
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.3695 -0.3845 0.0019 0.6123 2.3290
##
## Random effects:
## Groups Name Variance Std.Dev.
## Gender (Intercept) 0.04101 0.2025
## Number of obs: 16, groups: Gender, 2
##
## Fixed effects:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -0.22021 0.15994 -1.377 0.1686
## Decreeb.Post 1.69554 0.11116 15.254 <2e-16 ***
## ageclassage1 -0.70151 0.38006 -1.846 0.0649 .
## ageclassage2 -0.45632 0.21411 -2.131 0.0331 *
## ageclassage4 0.06160 0.18978 0.325 0.7455
## Decreeb.Post:ageclassage1 0.01867 0.50852 0.037 0.9707
## Decreeb.Post:ageclassage2 0.81689 0.43095 1.896 0.0580 .
## Decreeb.Post:ageclassage4 -0.58968 0.33423 -1.764 0.0777 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) Dcrb.P agcls1 agcls2 agcls4 Dc.P:1 Dc.P:2
## Decreeb.Pst -0.257
## ageclassag1 -0.081 0.110
## ageclassag2 -0.136 0.201 0.058
## ageclassag4 -0.144 0.234 0.063 0.119
## Dcrb.Pst:g1 0.059 -0.216 -0.747 -0.043 -0.049
## Dcrb.Pst:g2 0.073 -0.253 -0.030 -0.496 -0.054 0.056
## Dcrb.Pst:g4 0.081 -0.336 -0.036 -0.068 -0.569 0.072 0.083