AlphaDiversity Kruskal-Wallis (all groups)

Hi. Forum respresentative

I'm Gyusik Hwang

I'm asking you a question because there's something strange going on in the process of an Alpha diversity analysis.

The H and p-value are the same across all index(observed_otu, faith_pd, shannon, evenness).

I cannot understand why the variables input are different but the results are the same.

command and result are as below.

qiime phylogeny align-to-tree-mafft-fasttree --i-sequences rep-seqs.qza --o-alignment align-rep-seqs.qza --o-masked-alignment make-align-rep-seqs.qza --o-tree unroot.qza --o-rooted-tree rooted-tree.qza --p-n-threads 16

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

Community richness & (1.0 MB)

I'd be very grateful if you answered me.


1 Like

Good morning Gyusik Hwang,

That results is very strange! But I think I have an explanation!

While all four alpha diversity metrics are different, the stat test you are running on them is the same: the Kruskal-Wallis test by ranks, a one-way ANOVA on ranks. :bar_chart:

Also, the ranks you observe between groups is the same: All the samples in the YF group are always higher than all the samples in the AF group.
:1st_place_medal: :1st_place_medal: :1st_place_medal: :2nd_place_medal: :2nd_place_medal::2nd_place_medal:

Because the Kruskal-Wallis test only cares about ranks, and all the ranks are the same, your test statistics are always identical.

If some of these alpha diversity metrics overlapped, then the ranked test would be different.
:1st_place_medal: :1st_place_medal: :2nd_place_medal: :1st_place_medal: :2nd_place_medal::2nd_place_medal:

Let me know if that helped answer your question!



Hi Colin

Thanks for your answer. And Your answer was very helpful to me.

In the case of One-way ANOVA, many other say that it is used when there are more than three groups.

In my case, t-test is more suitable than one-way ANOVA test because there are two groups.

Am I going in the right direction?

Thank you once again.


1 Like

Good morning,

That sounds good to me! Iā€™m not sure if Qiime 2 implements this, but you could perform the t-test using another program.

If at all possible, you need some more samples too. 3 replicates per group might be enough, but more would be better.


1 Like

Hi @Gyusik_Hwang,

Just a side note here: think of a t-test as simple form of ANOVA with only 2 groups, though technically a t-test is comparing means while ANOVA compares variance between groups. You would expect to get nearly exact results between the two, contingent on the assumptions of the tests (normal distribution and unequal variance etc) being met. In short, using an ANOVA on 2 groups is totally fine, and in fact an ANOVA is more robust to violation of normal distribution (but not unequal variance).

That being said, I would make the argument that running any of these tests on n=3, even if technically doable, should not be used as they are essentially meaningless. You canā€™t predict a distribution from such low n value. Not to say that the data is not useful! But rather that the test is not giving you any useful information. I think in this case simply displaying the data in a jitter box plot will be sufficient.


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