Question 1

asprinA <- c(15,26,13,28,17,20,7,36,12,18)
asprinB <- c(13,20,10,21,17,22,5,30,7,11)

a. Alternate Hypothesis:

\(H_o: \mu_1 = \mu2\)

\(H_a: \mu_1\neq \mu_2\)

\(mu_1\) = Aspirin A \(mu_2\) = Aspirin B

b. Hypothesis Testing

boxplot(asprinA, asprinB)

t.test(asprinA, asprinB, alternative = "two.sided", paired =TRUE, var.equal= TRUE)
## 
##  Paired t-test
## 
## data:  asprinA and asprinB
## t = 3.6742, df = 9, p-value = 0.005121
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  1.383548 5.816452
## sample estimates:
## mean of the differences 
##                     3.6

From the boxplot, we assume that the variances are equal. The p-value is 0.005121 which is less than alpha which is 0.05. In conclusion We reject the null hypothesis and accept the alternate hypothesis that the means are different

c. Two Sample T-TEST

t.test(asprinA, asprinB, alternative = "two.sided", paired =FALSE, var.equal= TRUE)
## 
##  Two Sample t-test
## 
## data:  asprinA and asprinB
## 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

The p-value is 0.34 which is greater than alpha which is 0.05. In conclusion We fail to reject the null hypothesis

Question 2

activeExcercise <- c(9.50,10.00,9.75,9.75,9.00,13.0)
noExcercise <- c(11.50, 12.00,13.25,11.50,13.00,9.00)

a. Null and Alternate Hypothesis

\(H_o: \mu_1 = \mu2\)

\(H_a: \mu_1 < \mu_2\)

\(mu_1\) = Active Exercise \(mu_2\) = No Exercise

b. Why might yo want to use a non-parametric method for analyzing this data?

It does not meet the conditions for continuous data. Furthermore, the sample data is not paired and n is less than 30.

c. 

wilcox.test(activeExcercise, noExcercise, alternative = "less", paired = FALSE)
## Warning in wilcox.test.default(activeExcercise, noExcercise, alternative =
## "less", : cannot compute exact p-value with ties
## 
##  Wilcoxon rank sum test with continuity correction
## 
## data:  activeExcercise and noExcercise
## W = 9, p-value = 0.08523
## alternative hypothesis: true location shift is less than 0

The p-value IS 0.0853. This is greater than alpha(0.05). Therefore we fail to reject the null hypothesis. This means that the average time it take for an infant to walk from active exercise is not equal to the average time it take for an infant to walk from no exercise.

asprinA <- c(15,26,13,28,17,20,7,36,12,18)
asprinB <- c(13,20,10,21,17,22,5,30,7,11)

boxplot(asprinA, asprinB)
t.test(asprinA, asprinB, alternative = "two.sided", paired =TRUE, var.equal= TRUE)

boxplot(asprinA, asprinB)
t.test(asprinA, asprinB, alternative = "two.sided", paired =TRUE, var.equal= TRUE)

activeExcercise <- c(9.50,10.00,9.75,9.75,9.00,13.0)
noExcercise <- c(11.50, 12.00,13.25,11.50,13.00,9.00)

wilcox.test(activeExcercise, noExcercise, alternative = "less", paired = FALSE)