Q1.1-Test the hypothesis using a paired t-test, report the p-value and state your conclusion (alpha = 0.05) ?
aspirinA <- c(15,26,13,28,17,20,7,36,12,18)
aspirinB <- c(13,20,10,21,17,22,5,30,7,11)
paired_test <- t.test(aspirinA, aspirinB, paired = TRUE)
paired_test
##
## Paired t-test
##
## data: aspirinA and aspirinB
## t = 3.6742, df = 9, p-value = 0.005121
## alternative hypothesis: true mean difference is not equal to 0
## 95 percent confidence interval:
## 1.383548 5.816452
## sample estimates:
## mean difference
## 3.6
Q1.2-Suppose that you tested this hypothesis using a two-sample t-test (instead of a paired t-test). What would the p-value of your test have been?
independent_test <- t.test(aspirinA, aspirinB, paired = FALSE)
independent_test
##
## Welch Two Sample t-test
##
## data: aspirinA and aspirinB
## t = 0.9802, df = 17.811, p-value = 0.3401
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## -4.12199 11.32199
## sample estimates:
## mean of x mean of y
## 19.2 15.6
The sample size is small (n=6 per group) and the data might not be normal. That’s why we use the non-parametric Mann-Whitney U Test.
exercise <- c(9.50, 10.00, 9.75, 9.75, 9.00, 13.0)
no_exercise <- c(11.50, 12.00, 13.25, 11.50, 13.00, 9.00)
wilcox.test(exercise, no_exercise, alternative = "less")
## Warning in wilcox.test.default(exercise, no_exercise, alternative = "less"):
## cannot compute exact p-value with ties
##
## Wilcoxon rank sum test with continuity correction
##
## data: exercise and no_exercise
## W = 9, p-value = 0.08523
## alternative hypothesis: true location shift is less than 0
Since the p-value (0.08523) is greater than the alpha (0.05), we fail to reject the null hypothesis (H0). => There is insufficient evidence to support the claim that active exercise reduces the time it takes for infants to learn to walk alone.