R Markdown

\(H_0\): p = p2 \(H_a\): p > p2

  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

#right tail test for two proportions

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

There could be strong evidence to show that the female students taking biology exam is higher than the proportion of female students taking the calculus AB exam, large size of data.

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.

#test since objects conventional and new couldnt be found

Note that the echo = FALSE parameter was added to the code chunk to prevent printing of the R code that generated the plot.

t.test(conventional, new, alternative = "greater")
## 
##  Welch Two Sample t-test
## 
## data:  conventional and new
## t = 0.025371, df = 58.974, p-value = 0.4899
## alternative hypothesis: true difference in means is greater than 0
## 95 percent confidence interval:
##  -8.997749       Inf
## sample estimates:
## mean of x mean of y 
##  35.30000  35.16129

it seems like there might not be enough stastical evidence to show infants crying when they’re held and not held by their mothers.