Problem 1 Aspirin paired t test

Data : same 10 people measured 1 hour after Type A and Type B

A <- c(15,26,13,28,17,20,7,36,12,18)
B <- c(13,20,10,21,17,22,5,30,7,11)
d <- A - B
c(diffs = I(d), mean_d = mean(d), sd_d = sd(d), n = length(d))
##    diffs1    diffs2    diffs3    diffs4    diffs5    diffs6    diffs7    diffs8 
##  2.000000  6.000000  3.000000  7.000000  0.000000 -2.000000  2.000000  6.000000 
##    diffs9   diffs10    mean_d      sd_d         n 
##  5.000000  7.000000  3.600000  3.098387 10.000000

a : hypothesises H0: mean(A − B) = 0 (no difference in mean concentration) Ha: mean(A − B) ≠ 0 (two-sided)

b : Paired t-test (α = 0.05), report p-value and conclusion

t.test(A, B, paired = TRUE)   
## 
##  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

conclusion : the average within person difference is about 3.60 mg%. The paired t-test p value is about 0.005 (df = 9). Since p < 0.05, I reject H0. In this sample A is higher on average.

c : two-sample t-test instead of paired, whats p value?

t.test(A, B, var.equal = TRUE)  
## 
##  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
t.test(A, B)                    
## 
##  Welch Two Sample t-test
## 
## data:  A and B
## 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

Problem 2 infant walking time

Data:

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)

a : hypothesises H0: the two groups have the same distribution Ha: Active < NoExercise (one-sided; expect earlier walking with Active)

b : why non-parametric small samples (6 vs 6), ties, and normality is doubtful. The rank based Mann Whitney test is safer here

c : Mann-Whitney

wilcox.test(Active, NoExercise, alternative = "less")
## 
##  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

The one sided p value is about 0.09. Since p ≥ 0.05, I do not reject H0. The active group looks a little lower, but the evidence isn’t strong with n=6 per group.