Methods from the Ch7 lecture: - prop.test() - t.test()

Question 1

Hypothesis \(H_0\): \(p_1\) = \(p_2\) \(H_a\): \(p_1\) > \(p_2\)

Note: p_1 = Proportion of females taking bio exam p_2 = Proportion of females taking calc AB exam

α : 0.05

prop.test(x = c(84200, 102598), n = c(144790, 211693), p = NULL, alternative = "greater", conf.level = 0.95, correct = TRUE)
## 
##  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
# Note to self: conf.level = alpha, where 1 - 0.95 = 0.05, testing at the 5% level.

Due to the p-value being 2.2e-16 (less than 0.05), we reject the null hypothesis. Therefore, the proportion of females taking the bio exam is greater than the proportion of females taking the calc AB exam.

Question 2

Hypothesis \(H_0\): \(μ1\) = \(μ2\) \(H_a\): \(μ1\) > \(μ2\)

Note: μ1: Population/average of babies crying during conventional methods μ2: Population/average of babies crying when held by their mothers

α : 0.05

popConventional <- 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)

popMothersMethod <- 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(popConventional, popMothersMethod, alternative = "greater", conf.level = 0.95)
## 
##  Welch Two Sample t-test
## 
## data:  popConventional and popMothersMethod
## t = 0.029953, df = 57.707, p-value = 0.4881
## alternative hypothesis: true difference in means is greater than 0
## 95 percent confidence interval:
##  -9.135003       Inf
## sample estimates:
## mean of x mean of y 
##  35.30000  35.13333

Due to the p-value being 0.4881 (greater than 0.05), we do not have sufficient evidence, therefore, failing to reject the null hypothesis.