1. Many high school students take the AP tests in different subject areas. In 2017, of the 144,790 students who took the biology exam 84,200 of them were female. In that same year, of the 211,693 students who took the calculus AB exam 102,598 of them were female. Is there enough evidence to show that the proportion of female students taking the biology exam is higher than the proportion of female students taking the calculus AB exam? Test at the 5% level.

Hypothesis:

H_0: p1 = p2 H_1: p1 > p2

prop.test(c(84200, 102598), c(144790, 211693), alternative = "greater")
## 
##  2-sample test for equality of proportions with continuity correction
## 
## data:  c(84200, 102598) out of c(144790, 211693)
## X-squared = 3234.9, df = 1, p-value < 2.2e-16
## alternative hypothesis: greater
## 95 percent confidence interval:
##  0.09408942 1.00000000
## sample estimates:
##    prop 1    prop 2 
## 0.5815319 0.4846547

P value: < 2.2e-16

Significance level: 0.0940, 1.0000

Conclusion: The P-value is statistically significant, significance level is above zero showing that there is a higher proportion of female students taking the Biology AP exam. We reject the null hypothesis.

2.A vitamin K shot is given to infants soon after birth. The study is to see if how they handle the infants could reduce the pain the infants feel. One of the measurements taken was how long, in seconds, the infant cried after being given the shot. A random sample was taken from the group that was given the shot using conventional methods, and a random sample was taken from the group that was given the shot where the mother held the infant prior to and during the shot. Is there enough evidence to show that infants cried less on average when they are held by their mothers than if held using conventional methods? Test at the 5% level.

Hypothesis:

H0: µd = 0

H1: µd ≠ 0

Old <- c(63,0,2,46,33,33,29,23,11,12,48,15,33,14,51,37,24,70,63,0,73,39,54,52,39,34,30,55,58,18)

New <- c(0,32,20,23,14,19,60,59,64,64,72,50,44,14,10,58,19,41,17,5,36,73,19,46,9,43,73,27,25,18)

t.test(Old, New, paired = TRUE)
## 
##  Paired t-test
## 
## data:  Old and New
## t = 0.028519, df = 29, p-value = 0.9774
## alternative hypothesis: true mean difference is not equal to 0
## 95 percent confidence interval:
##  -11.78558  12.11892
## sample estimates:
## mean difference 
##       0.1666667

P value: 0.9774

Significance level: -11.78 - 12.11

Conclusion: The p-value indicates results are not statistically significant at the 0.05 level, significance level is not entirely above zero so there were some results that were worse with the new method compared to the old. There is not enough evidence to show that infants cried less than whith the old method, therefore we don’t reject the null hypothesis.