I just did a series of 40 t-tests and then proceeded to use bonferroni correction for multiple testing and my P values reduced in size. Why does this happen? I was my impression that multiple tests correction would always result in an increase in p value size.
Before correction:
substrate p_value
19 glycan 0.000139091904182433
23 dermatan sulfate 0.000139091904182433
4 chitin 0.000294435140367691
22 xylose 0.00387472305660014
5 beta-glucan 0.00552400891530821
2 cellulose 0.0130881279666714
After correction:
substrate p_value
10 glucose 5.110415e-21
29 fructose 1.745709e-20
26 lignin 7.090204e-18
30 cyclomaltodextrin 3.569263e-10
31 lacto-N-tetraose 3.569263e-10
32 hyaluronate 3.569263e-10
Code used to generate the P values:
# loop labeling one substrate as "A" and every other substrate as "B" then doing a T test between then counts
sub_pvals = NULL
for(sub in unique(cazy_cata_melt$Substrate)){
df= cazy_cata_melt
df[df$Substrate != sub,]$Substrate = "B"
df[df$Substrate == sub,]$Substrate = "A"
input = cbind(substrate = sub, p_value = t.test(value ~ Substrate, data = df)[[3]][1])
sub_pvals = rbind.data.frame(sub_pvals, input)
}
#correction for multiple testing
sub_pvals$p_value = p.adjust(sub_pvals$p_value, method = "bonferroni", n = length(unique(cazy_cata_melt$Substrate)))
#ordering the dataframe
sub_pvals = sub_pvals[order(sub_pvals$p_value),]
Data available here: https://pastebin.com/vsbYGkQW