I have to compare three groups. Three measurements using 3 different methods on the same subjects. The variables are not normal, and the measures concern the same people, so dependent samples. I can use Kruskal-Wallis? I can use Wilcoxon post analysis with Bonferroni correction? How can I use the Bonferroni correction in R? Can I have examples?
It seems some misunderstanding have arose in comments, so here is an answer.
Why we shouldn't use Wilcoxon test as post-hoc?
Pairwise Wilcox-Mann-whitney test doesn't take into account ranks from Kruskal-Wallis test, it creates it's own. On the other side Dunn's test use group ranking from KW test.
Example with R:
set.seed(pi) df <- data.frame(val = c(runif(15, 0, 15), runif(15, 0, 15), runif(15, 10, 20)), grp = rep(c('A', 'B', 'C'), each = 15)) kruskal.test(val ~ grp, df) Kruskal-Wallis rank sum test data: val by grp Kruskal-Wallis chi-squared = 22.045, df = 2, p-value = 1.633e-05
So Kruskal-Wallis test tells us that there is statistically significant differences between groups. But we need to run Dunn's test to know between which pairs of group we have difference .
require(PMCMR) posthoc.kruskal.dunn.test(val ~ grp, df) Pairwise comparisons using Dunn's-test for multiple comparisons of independent samples data: val by grp A B B 0.96674 - C 0.00013 0.00013 P value adjustment method: holm
And we can conclude that group C is different from A and B.
Okey, I missed part about dependent samples.
In case of dependent samples Friedman test with appropriate post-hoc (Conover test in
PMCMR for example) should be used. But general approach (just with correct tests) I showed above is still applicable.