In this report we compare aspirin concentrations in blood and also check if exercise reduces time taken for infants to walk.
asp_A <- c(15, 26, 13, 28, 17, 20, 7, 36, 12, 18)
asp_B <- c(13, 20, 10, 21, 17, 22, 5, 30, 7, 11)
Let \(\mu_d\) be the difference between the mean of the concentration of Aspirin A to Aspirin B.
\(H_0: \mu_d = 0\)
\(H_a: \mu_d \ne 0\)
t.test(asp_A, asp_B, paired = TRUE)
##
## Paired t-test
##
## data: asp_A and asp_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
The p-value is 0.005121.
Since this is below 0.05, we reject \(H_0\) as the mean concentrations differ significantly.
t.test(asp_A, asp_B, paired = FALSE)
##
## Welch Two Sample t-test
##
## data: asp_A and asp_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
The two-sample p-value is 0.3401.
Since it exceeds 0.05we fail to reject \(H_0\).
active <- c(9.50, 10.00, 9.75, 9.75, 9.00, 13.00)
no_exercise <- c(11.50, 12.00, 13.25, 11.50, 13.00, 9.00)
Let \(\mu_A\) and \(\mu_N\) be the mean time taken to walk time for infants with active exercise and infants with no excercise respectively.
\(H_0: \mu_A = \mu_N\).
\(H_a: \mu_A < \mu_N\)
We might want to use a non-parametric method as each group has a very small number of infants, and hence can not be sure that the walking times follow a normal distribution.
wilcox.test(active, no_exercise,
alternative = "less",
exact = FALSE,
correct = TRUE)
##
## Wilcoxon rank sum test with continuity correction
##
## data: active and no_exercise
## W = 9, p-value = 0.08523
## alternative hypothesis: true location shift is less than 0
The test gives W = 9 and p = 0.08523.
Since p exceeds 0.05 we do not reject \(H_0\).
Hence there is insufficient evidence that active exercise leads to earlier walking in infants.