In R, I was running pairwise t tests after a significant ANOVA. To understand better how pairwise t tests work, I set the method to adjust p-values to 'none'
, I was thus expecting to have exactly the same as if I was comparing 'manually' each group. However, this does not seem to be the case.
Why is that?
Here is an example.
My data:
df <- structure(list(treatment = structure(c(1L, 1L, 1L, 1L, 3L, 3L, 3L, 3L, 2L, 2L, 2L, 2L, 4L, 4L, 4L, 4L, 8L, 8L, 8L, 8L, 10L, 10L, 10L, 10L, 9L, 9L, 9L, 9L, 5L, 5L, 5L, 5L, 7L, 7L, 7L, 7L, 6L, 6L, 6L, 6L), .Label = c("oa", "oa_bhb_1000", "oa_bhb_500", "oa_bhb_5000", "oa_d_phe_10", "oa_d_phe_100", "oa_d_phe_50", "oa_l_phe_10", "oa_l_phe_100", "oa_l_phe_50"), class = "factor"), intensity = c(952343, 963296, 981994, 983969, 1258960, 918174, 1273620, 1281570, 1103510, 1154570, 1191380, 1063730, 974519, 948350, 911960, 892873, 1171440, 1066490, 1027280, 1004430, 1047480, 1185930, 987433, 1179250, 962765, 1107980, 1225000, 1054180, 1137860, 1239670, 998971, 1095830, 1166230, 1183520, 991854, 897242, 839749, 864329, 929698, 678285)), .Names = c("treatment", "intensity"), class = "data.frame", row.names = 41:80)
Running the ANOVA:
summary(aov (intensity ~ treatment, data = df))
p-value = 0.00102
Running the pairwise t tests without p-value adjustment:
pairwise.t.test (df$intensity, df$treatment, p.adjust.method = 'none')
Example, the p-value of the t test comparing treatment oa
with treatment oa_bhb_500
is 0.00606
.
But if I run this test manually:
t.test (df$intensity[1:4], df$intensity[5:8])
I get a p-value of 0.09493
.
How can that be? Am I doing something wrong?