###################################################################### # STAT 7010 - Experimental Statistics II # Peng Zeng (Auburn University) # 2023-01-12 ###################################################################### tip1 = c(7, 3, 3, 4, 8, 3, 2, 9, 5, 4) tip2 = c(6, 3, 5, 3, 8, 2, 4, 9, 4, 5) ###################################################################### # paired t-test --- manual calculation ###################################################################### n = length(tip1) diff.mean = mean(tip1 - tip2) diff.sd = sd(tip1 - tip2) t0 = diff.mean / (diff.sd / sqrt(n)) p.value = 2 * pt(abs(t0), df = n - 1, lower = FALSE) ###################################################################### # t.test() ###################################################################### t.test(tip1, tip2, paired = TRUE) # paired t-test t.test(tip1, tip2) # two-sample t-test ###################################################################### # THE END ######################################################################