Two Sample Tests (Matched or Independent)
Chen Hao posted on 13 Mar 2016This is my course notes for Mathematical Biostatistics Boot Camp 2, course materials are free on github.
1. Matched data
Example
R Code
diff <- test2 - test1
n <- sum(!is.na(diff)) #49
mean(diff) #2.88
sd(diff) #7.61
testStat <- sqrt(n) * mean(diff) / sd(diff) #2.65
# below works out to be 0.01
2 * pt(abs(testStat), n -1, lower.tail = FALSE)
##uses the R function
t.test(diff)
Discussion of matched data
Regression to mediocrity
Comments
2. Two independent groups
Example
- 1 note this is not obtained by averaging the two standard deviations, it’s obtained by averaging the variances then square rooting