The concentrations for Aspirin A and Aspirin B were measured on the same 10 people.
A <- c(15,26,13,28,17,20,7,36,12,18)
B <- c(13,20,10,21,17,22,5,30,7,11)
Because both measurements were obtained from the same individuals, the observations are paired.
The hypotheses are:
\(H_0: \mu_A - \mu_B = 0\)
\(H_a: \mu_A - \mu_B \neq 0\)
The null hypothesis states that the mean urine concentrations of the two aspirin types are the same. The alternative states that they are different.
paired.test <- t.test(A, B,
paired=TRUE,
alternative="two.sided")
paired.test
##
## Paired t-test
##
## data: A and 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
Using a significance level of 0.05, the p-value is approximately 0.0051. Since the p-value is less than 0.05, we reject the null hypothesis.
There is sufficient evidence that the mean urine concentrations of Aspirin A and Aspirin B are different.
two.sample.test <- t.test(A, B,
paired=FALSE,
var.equal=TRUE,
alternative="two.sided")
two.sample.test
##
## Two Sample t-test
##
## data: A and B
## t = 0.9802, df = 18, p-value = 0.34
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## -4.116103 11.316103
## sample estimates:
## mean of x mean of y
## 19.2 15.6
If the data were incorrectly analyzed as two independent samples using a pooled two-sample t-test, the p-value would be approximately 0.3400.
This is much larger than the p-value from the paired t-test and would not result in rejection of the null hypothesis at alpha = 0.05.
Active <- c(9.50,10.00,9.75,9.75,9.00,13.00)
NoExercise <- c(11.50,12.00,13.25,11.50,13.00,9.00)
The research question asks whether active exercise shortens the time required for an infant to learn to walk.
The hypotheses are:
\(H_0:\) The distributions of walking times for the Active Exercise and No Exercise groups are the same.
\(H_a:\) Walking times for the Active Exercise group tend to be lower than walking times for the No Exercise group.
A non-parametric method may be appropriate because the sample sizes are very small, with only six infants in each group. With such small samples, it is difficult to reliably verify the normality assumption required for a two-sample t-test. The Mann-Whitney U test does not require the data to follow a normal distribution.
mw.test <- wilcox.test(Active, NoExercise,
alternative="less",
paired=FALSE,
exact=FALSE)
mw.test
##
## Wilcoxon rank sum test with continuity correction
##
## data: Active and NoExercise
## W = 9, p-value = 0.08523
## alternative hypothesis: true location shift is less than 0
At alpha = 0.05, the p-value is greater than 0.05. Therefore, we fail to reject the null hypothesis.
There is not sufficient evidence at the 0.05 significance level to conclude that active exercise shortens the time it takes infants to learn to walk independently.
A <- c(15,26,13,28,17,20,7,36,12,18)
B <- c(13,20,10,21,17,22,5,30,7,11)
paired.test <- t.test(A, B,
paired=TRUE,
alternative="two.sided")
paired.test
two.sample.test <- t.test(A, B,
paired=FALSE,
var.equal=TRUE,
alternative="two.sided")
two.sample.test
Active <- c(9.50,10.00,9.75,9.75,9.00,13.00)
NoExercise <- c(11.50,12.00,13.25,11.50,13.00,9.00)
mw.test <- wilcox.test(Active, NoExercise,
alternative="less",
paired=FALSE,
exact=FALSE)
mw.test