aspirin_A <- c(15, 26, 13, 28, 17, 20, 7, 36, 12, 18)
aspirin_B <- c(13, 20, 10, 21, 17, 22, 5, 30, 7, 11)
t_test_result <- t.test(aspirin_A, aspirin_B, paired = TRUE)
t_test_result
## 
##  Paired t-test
## 
## data:  aspirin_A and aspirin_B
## 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

conclusion p-value: r round(t_test_result$p.value, 4) Since p-value < 0.05, we reject the null hypothesis. There is significant evidence that the mean concentrations of Aspirin A and B are different in urine samples 1 hour after intake. Two sample t-test

indep_t_test <- t.test(aspirin_A, aspirin_B, paired = FALSE)
indep_t_test
## 
##  Welch Two Sample t-test
## 
## data:  aspirin_A and aspirin_B
## 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

Using an independent t-test here is not ideal, because each subject serves as their own control. Still, it’s useful to see what difference it makes. Quwation 2 instead of a t-test, we use a non-parametric test like the Mann-Whitney U test because sample size is small and we dont know if the data is normally distributed.

active_exercise <- c(9.5, 10.0, 9.75, 9.75, 9.0, 13.0)
no_exercise <- c(11.5, 12.0, 13.25, 11.5, 13.0, 9.0)
wilcox_result <- wilcox.test(active_exercise, no_exercise, alternative = "less")
## Warning in wilcox.test.default(active_exercise, no_exercise, alternative =
## "less"): cannot compute exact p-value with ties
wilcox_result
## 
##  Wilcoxon rank sum test with continuity correction
## 
## data:  active_exercise and no_exercise
## W = 9, p-value = 0.08523
## alternative hypothesis: true location shift is less than 0

conclusion: p-value: r round(wilcox_result$p.value, 4) Since p-value < 0.05, we reject the null hypothesis. There is statistically significant evidence that infants who receive active exercise walk earlier than those who do not.