QUESTION 1 Data Entering
AspirinA<-c(15,26,13,28,17,20,7,36,12,18)
AspirinB<-c(13,20,10,21,17,22,5,30,7,11)
PART A:Suppose we want to test the hypothesis that the mean concentrations of the two drugs are the same in urine specimens. State the appropriate hypothesis. Answer : H_{0}: *{1}= :Mean of AspirinA = Mean of AspirinB H_{1}: *{1}\neq \mu {2} Mean of AspirinA not equal to Mean of AspirinB Paired T Test Hypothesis Testing
PART B:Test the hypothesis using a paired t-test, report the p-value and state your conclusion (alpha = 0.05)
t.test(AspirinA,AspirinB, alternative = c("two.sided"), 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
Conclusion: Since the P value is not that small. Therefore we reject the null Hypothesis and hence mean of aspirin A is not equal to mean of aspirin B.
PART C:Suppose that you tested this hypothesis using a two-sample t-test (instead of a paired t-test). What would the p-value of your test have been?
t.test(AspirinA,AspirinB, alternative = c("two.sided"), 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
QUESTION 2 Data Entering
ActiveExercise<-c(9.5,10,9.75,9.75,9,13)
NoExercise<-c(11.5,12,13.25,11.5,13,9)
PARTA: State the null and alternative hypothesis Answer : H_{0}: *{1}= :Mean of ActiveExcercise = NoExcersie H_{1}: *{1}< Mean of ActiveExcersie is less than Mean of NoExcersie
PARTB:Why might you want to use a non-parametric method for analyzing this data?
qqnorm(ActiveExercise)
qqline(ActiveExercise)
qqnorm(NoExercise)
qqline(NoExercise)
boxplot(ActiveExercise,NoExercise)
Since the no of samples are very less to make any comment regarding the normality and constant variances we cannot properly conclude. Hence, we will use Non parametric Test for better Understanding.
PARTC:Analyze using the Mann-Whitney-U test using R with alpha=0.05
wilcox.test(ActiveExercise,NoExercise,alternative = "less")
## Warning in wilcox.test.default(ActiveExercise, NoExercise, alternative =
## "less"): cannot compute exact p-value with ties
##
## Wilcoxon rank sum test with continuity correction
##
## data: ActiveExercise and NoExercise
## W = 9, p-value = 0.08523
## alternative hypothesis: true location shift is less than 0
Since the p value > alpha given. Therefore we accept the Null Hypothesis that the two means are equal.