Exercise 3.1 See the Arbuthnot data in HistData library. The Arbuthnot data set refers to Dr. John Arbuthnot, an 18th century physician, writer, and mathematician. He was interested in the ratio of newborn boys to newborn girls, so he gathered the christening records for children born in London for every year from 1629 to 1710. It also contains the variable Ratio, giving the ratio of male to female births.
library(“HistData”) library(“plotly”)
summary(Arbuthnot)
maxRatio<-max(Arbuthnot\(Ratio) minRatio<-min(Arbuthnot\)Ratio) plot_ly(Arbuthnot, x= ~Year, y= ~Ratio, name=“Male vs Female Birth Ratio”, type=‘scatter’, mode=‘lines’,line = list(color = ‘black’, width = 1) ) %>% add_trace(y = ~maxRatio, name = ‘Maximum’, mode = ‘lines’, line = list(color = ‘blue’, width = 1)) %>% add_trace(y = ~minRatio, name=“Minimum”, mode =‘lines’, line = list(color= ‘green’, width=1)) %>% add_trace(y=1, name=“Reference Line”, mode=‘lines’, line = list(color=‘red’, width=1))
maxT <- max(Arbuthnot\(Total) minT <- min(Arbuthnot\)Total) plot_ly(Arbuthnot, x = ~Year, y = ~Total, name = ‘Total Number of Christenings(Unit:1,000)’, type = ‘scatter’, mode = ‘line’, line = list(color = ‘black’, width = 1)) %>% add_trace(y = ~maxT, name = ‘Max Christening’, line = list(color = ‘blue’, width = 1)) %>% add_trace(y = ~minT, name = ‘Min Christening’, line = list(color = ‘green’, width = 1))
## Number of cases in table: 100
## Number of factors: 1
number of women in queues of length 10 might depart from a binomial distribution, Bin(n = 10, p = 1/2).
The deviation from binomial distribution might be caused by a small sample size, or a special queueing preference displayed by the women - the latter would require further investigation.
##
## Goodness-of-fit test for binomial distribution
##
## X^2 df P(> X^2)
## Likelihood Ratio 97.0065 11 6.978187e-16
##
## Goodness-of-fit test for binomial distribution
##
## X^2 df P(> X^2)
## Pearson 249.1954 12 2.013281e-46
## Likelihood Ratio 205.4060 12 2.493625e-37