1-a. Null hypothesis: (H_0: μ_1 = μ_2)

The mean concentrations of the two drugs in urine specimens are equal.

Alternative hypothesis: (H_1: μ_1 ≠ μ_2)

The mean concentrations of the two drugs in urine specimens are not equal.

aspirin_data <- data.frame(
  Person = 1:10,
  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)
)
paired_result <- t.test(aspirin_data$Aspirin_A, aspirin_data$Aspirin_B, paired = TRUE)
paired_result
## 
##  Paired t-test
## 
## data:  aspirin_data$Aspirin_A and aspirin_data$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

1-b. The resulting p-value is 0.001215, which is less than the significance level (α = 0.05). Therefore, we reject the null hypothesis. This indicates that there is a statistically significant difference in the mean 1-hour urine concentrations between Aspirin A and Aspirin B.

two_sample_result <- t.test(aspirin_data$Aspirin_A, aspirin_data$Aspirin_B, paired = FALSE)
two_sample_result
## 
##  Welch Two Sample t-test
## 
## data:  aspirin_data$Aspirin_A and aspirin_data$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

1-c. If a two-sample t-test is used, the p-value becomes 0.3401. As a result, one would mistakenly fail to reject (accept) the null hypothesis.

2-a. Null Hypothesis: (H_0: μ_1 ≥ μ_2)

The mean walking time for infants who receive Active Exercise is greater than or equal to that for those who receive No Exercise.

Alternative Hypothesis: (H_1: μ_1 < μ_2)

The mean walking time for infants who receive Active Exercise is less than that for those who receive No Exercise.

2-b. A non-parametric method, such as the Mann-Whitney U test, might be useful for this data for a couple of reasons:

  1. Small sample size: Each group only has 6 observations, so it is difficult to tell whether the data are normally distributed.
  2. No normality assumption: A non-parametric test does not require the data to follow a normal distribution, so it can be a better choice when the sample is small or the data may not be normally distributed.
infant_data <- data.frame(
  Active_Exercise = 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)
)

mw_result <- wilcox.test(infant_data$Active_Exercise, 
                         infant_data$No_Exercise, 
                         alternative = "less", 
                         exact = FALSE)
mw_result
## 
##  Wilcoxon rank sum test with continuity correction
## 
## data:  infant_data$Active_Exercise and infant_data$No_Exercise
## W = 9, p-value = 0.08523
## alternative hypothesis: true location shift is less than 0

2-c. Since the p-value 0.08523 is greater than α = 0.05, we fail to reject the null hypothesis. Therefore, there is not sufficient evidence to conclude that active exercise significantly shortens the time it takes an infant to learn how to walk alone.