Question 1

Part A

  • Null hypothesis: \(H_0:\mu_1=\mu_2\) the mean concentrations of the two drugs are the same

  • Alternative hypothesis: \(H_a:\mu_1\neq\mu_2\) the mean concentrations of the two drugs are different

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)

Part B

Testing Hypothesis using paired T-test

t.test(Aspirin_A,Aspirin_B, alternative = c("two.sided"), paired = TRUE, var.equal = TRUE, conf.level = 0.95)
## 
##  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 is 0.005 < alpha: Reject the null hypothesis => the mean concentrations of the two drugs are different

Part C

Testing Hypothesis using 2-sample T-test

t.test(Aspirin_A,Aspirin_B, alternative = c("two.sided"), paired = FALSE, var.equal = TRUE, conf.level = 0.95)
## 
##  Two Sample t-test
## 
## data:  Aspirin_A and Aspirin_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

Conclusion: P value is 0.34 > alpha: There is not evident to reject the null hypothesis. The P value is increased becasuse the two sample test assume that the data is independent and it included the co-variance when calculate the variance.

Question 2

Part A

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)

Null Hypothesis: \(H_0:\mu_1=\mu_2\)

Alternative Hypothesis: \(H_a:\mu_1<\mu_2\) or \(H_a:\mu_1>\mu_2\)

\(\mu_1\) = mean time to walk for children in months who receive active exercise

\(\mu_2\) = mean time to walk for children in months who do not receive active exercise

Part B

The reason we use a non-parametric method for analyzing this data

For Active Exercise:

qqnorm(Active_Exercise, main = "NPP of Active exercise group")
qqline(Active_Exercise)

For Non-active exercise:

qqnorm(No_Exercise, main = "NPP of No exercise group")
qqline(No_Exercise)

Conclusion: Based on the analysis, since the first data is far from the normal line, it does not meet normality. As the sample size is too small and both data of two group are not normal as shown in the NPP. We need to do the non-parametric test

Part C

Analysis using the Mann-Whitney-U test:

wilcox.test(Active_Exercise,No_Exercise, alternative = "less")
## 
##  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 = 0.085 is greater than alpha = 0.05, hence we fail to reject the null hypothesis.

Complete R Code:

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(Aspirin_A,Aspirin_B, alternative = c("two.sided"), paired = TRUE, var.equal = TRUE, conf.level = 0.95)
t.test(Aspirin_A,Aspirin_B, alternative = c("two.sided"), paired = FALSE, var.equal = TRUE, conf.level = 0.95)
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)
qqnorm(Active_Exercise, main = "NPP of Active exercise group")
qqline(Active_Exercise)
qqnorm(No_Exercise, main = "NPP of No exercise group")
qqline(No_Exercise)
wilcox.test(Active_Exercise,No_Exercise, alternative = "less")