Kruskal-Wallis test of alpha diversity


I have a question about statistical analysis of alpha diversity between groups.

Qiime2 gives the result of Kruskal-Wallis test and that of Kruskal-Wallis(pairwirse) test between group with the score of alpha diversity after qiime diversity core-metrics-phylogenetic.
If I understand correctly, Kruskal-Wallis test isn’t a pairwise test.
Which pairwise test was used in Qiime2?

Thank you in advance,



Hello Ayaka,

Great question! Can you post the full command you ran? You mentioned it’s core-metrics-phylogenetic, and the full method would help us validate what it’s doing.


Hello Colin,

Thank you for your response.

I run this command.

qiime diversity core-metrics-phylogenetic
–i-phylogeny rooted-tree.qza
–i-table table.qza
–p-sampling-depth 1000
–m-metadata-file sample-metadata.txt
–output-dir core-metrics-results

qiime diversity alpha-group-significance
–i-alpha-diversity core-metrics-results/shannon_vector.qza
–m-metadata-file sample-metadata.txt
–o-visualization core-metrics-results/shannon_vector.qzv

Then, I got the figure of box plot, Kruskal-Wallis (all groups) and Kruskal-Wallis (pairwise).


Hi @kiara!

Kruskal-Wallis can be applied to two or more groups, so it can be applied in a pairwise manner (i.e. comparing two groups at a time), or to all groups simultaneously. alpha-group-significance uses the Kruskal-Wallis test for both “all groups” and “pairwise” tests.

Kruskal-Wallis is a non-parametric version of the one-way ANOVA test. Just as ANOVA can be applied to 2+ groups and is a generalization of the t-test (which works with 2 groups only), Kruskal-Wallis can be applied to 2+ groups and is a generalization of the Mann-Whitney U test. See this Wikipedia page for more details. Hope this helps!


Just an additional question on this topic. What is the q-value shown in the alpha diversity pairwise comparison table (as produced in the output from above). Is this an adjusted P value? If so, what type of adjustment method have been used? This would be good to know for reporting in a paper.


Yep! It’s a p-value with a Benjamini & Hochberg correction. See this paper (PDF link).


Aha! I guessed as much, thanks for looking into it! Perhaps a little text indicating that should be placed by the outcome table? Or replace q-value with adj.p as is more commonly used?

1 Like

Thank you very much, @jairideout!
I understand.

1 Like

We have an open issue to add a description of the p-value correction method to alpha-group-significance. We’ll follow up here when that’s available in a release!


This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.