Arbuthnot’s data on the sex ratio of births in London was examined in Chapter 3. Use a binomial logistic regression model to assess whether the proportion of male births varied with the variables Year, Plague, and Mortality in the Arbuthnot data set. Produce effect plots for the terms in this model. What do you conclude? Compare your results with a null model whereas you only have the intercept of the curve.

 data(Arbuthnot, package="HistData")
View(Arbuthnot)
library(effects)
## Loading required package: carData
## lattice theme set by effectsTheme()
## See ?effectsTheme for details.
library(car)
## 
## Attaching package: 'car'
## The following objects are masked from 'package:carData':
## 
##     Guyer, UN, Vocab
library(vcdExtra)
## Loading required package: vcd
## Loading required package: grid
## Loading required package: gnm
## 
## Attaching package: 'vcdExtra'
## The following object is masked from 'package:car':
## 
##     Burt
## The following object is masked from 'package:carData':
## 
##     Burt
summary(Arbuthnot)
##       Year          Males         Females         Plague        
##  Min.   :1629   Min.   :2890   Min.   :2722   Min.   :    0.00  
##  1st Qu.:1649   1st Qu.:4759   1st Qu.:4457   1st Qu.:    0.00  
##  Median :1670   Median :6073   Median :5718   Median :    3.00  
##  Mean   :1670   Mean   :5907   Mean   :5535   Mean   : 1240.70  
##  3rd Qu.:1690   3rd Qu.:7576   3rd Qu.:7150   3rd Qu.:   22.25  
##  Max.   :1710   Max.   :8426   Max.   :7779   Max.   :68596.00  
##    Mortality         Ratio           Total       
##  Min.   : 8393   Min.   :1.011   Min.   : 5.612  
##  1st Qu.:12739   1st Qu.:1.048   1st Qu.: 9.199  
##  Median :17867   Median :1.065   Median :11.813  
##  Mean   :17816   Mean   :1.071   Mean   :11.442  
##  3rd Qu.:21030   3rd Qu.:1.088   3rd Qu.:14.723  
##  Max.   :97306   Max.   :1.156   Max.   :16.145
Arbuthnot$Males<-as.numeric(Arbuthnot$Males>"None")
arbuthnot.logistic<-glm(formula = Males ~ Year + Plague + Mortality, family = binomial, data = Arbuthnot)
summary(arbuthnot.logistic)
## 
## Call:
## glm(formula = Males ~ Year + Plague + Mortality, family = binomial, 
##     data = Arbuthnot)
## 
## Deviance Residuals: 
##        Min          1Q      Median          3Q         Max  
## -2.409e-06  -2.409e-06  -2.409e-06  -2.409e-06  -2.409e-06  
## 
## Coefficients:
##               Estimate Std. Error z value Pr(>|z|)
## (Intercept) -2.657e+01  6.228e+06       0        1
## Year        -6.945e-16  3.888e+03       0        1
## Plague      -1.218e-18  2.196e+01       0        1
## Mortality    8.413e-19  1.794e+01       0        1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 0.0000e+00  on 81  degrees of freedom
## Residual deviance: 4.7573e-10  on 78  degrees of freedom
## AIC: 8
## 
## Number of Fisher Scoring iterations: 25
plot(jitter(Year,2)~Males,data=Arbuthnot,ylab="Probability(year)")

coef(arbuthnot.logistic)
##   (Intercept)          Year        Plague     Mortality 
## -2.656607e+01 -6.944593e-16 -1.217462e-18  8.412722e-19
exp(coef(arbuthnot.logistic))
##  (Intercept)         Year       Plague    Mortality 
## 2.900701e-12 1.000000e+00 1.000000e+00 1.000000e+00
exp(10*coef(arbuthnot.logistic)[2])
## Year 
##    1