1a
\(H_a: \mu\_1 - \mu\_2 \neq 0\)
\(H_a: \mu\_1 - \mu\_2 \ = 0\)
Where μ1 & μ2 = mean concentrations of Aspirin A & B in a subject’s specimen
AspirinA<- c(15,26,13,28,17,20,7,36,12,18)
AspirinB<- c(13,20,10,21,17,22,5,30,7,11)
t.test(AspirinA,AspirinB,paired = TRUE)
##
## 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
1b The p-value of paired t-test is 0.005121
Conclusion: Since p-value (0.005121) < significance level (0.05), we can reject the Null hypothesis
t.test(AspirinA,AspirinB,paired = FALSE)
##
## 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
1c
The p-value of Two sample t-test is 0.3401
Conclusion: Since p-value (0.3401) > significance level (0.05), we fail to reject Null Hypothesis
2a
\(H_a: \mu\_1 - \mu\_2 \neq 0\)
\(H_a: \mu\_1 - \mu\_2 \ < 0\)
Where μ1 = mean time to walk in months for the ‘active exercise group’ & μ2= mean time to walk in months for the ‘non-stimulated Ones’
A<- c(9.5, 10, 9.75, 9.75, 9, 13)
B<- c(11.5, 12, 13.25, 11.5, 13, 9)
qqnorm(A)
qqline(A)
qqnorm(B)
qqline(B)
2b
Conclusion:From the plot above we can see that the data are skewed which means the data are not normally distributed so we need to perform the non-parametric test
?wilcox.test
## starting httpd help server ... done
wilcox.test(A,B, alternative = "less")
## Warning in wilcox.test.default(A, B, alternative = "less"): cannot compute
## exact p-value with ties
##
## Wilcoxon rank sum test with continuity correction
##
## data: A and B
## W = 9, p-value = 0.08523
## alternative hypothesis: true location shift is less than 0
2c
Conclusion: p=0.08523 and Test Statistic W=9. The p value is greater than the significance level which means it failed to reject the null hypothesis
AspirinA<- c(15,26,13,28,17,20,7,36,12,18)
AspirinB<- c(13,20,10,21,17,22,5,30,7,11)
t.test(AspirinA,AspirinB,paired = TRUE)
t.test(AspirinA,AspirinB,paired = FALSE)
A<- c(9.5, 10, 9.75, 9.75, 9, 13)
B<- c(11.5, 12, 13.25, 11.5, 13, 9)
qqnorm(A)
qqline(A)
qqnorm(B)
qqline(B)
?wilcox.test
wilcox.test(A,B, alternative = "less")