Adonis output not including all formulae

I have two isses. First, I am running qiime diversity adonis and getting a problem where the output visualization isn't showing me the results of all the formulae I've entered. Specifically, I am not getting results for "habitat." This happens when I separate my metadata groups by + or *.

adonis-animal species life-stage site habitat2.qzv (247.2 KB)

Here is my script:

qiime diversity adonis --i-distance-matrix unweighted-unifrac-distance-matrix.qza --m-metadata-file rarefied-metadata.txt --p-formula "animal+species+lifestage+site+habitat" --o-visualization adonis-animal+species+life-stage+site+habitat2.qzv

Second, when i separate my formula by * (in order to get the effect of their interaction), I don't get every combination of interaction. Is this normal?
adonis-animal species life-stage site habitat3.qzv (247.4 KB)

qiime diversity adonis --i-distance-matrix unweighted-unifrac-distance-matrix.qza --m-metadata-file rarefied-metadata.txt --p-formula "animal*species*lifestage*site*habitat" --o-visualization adonis-animal+species+life-stage+site+habitat3.qzv

I am not an expert on adonis so perhaps I am missing something here?

Hi @Alan_Chan,
Thank you for reporting this, and for sharing the QZVs.

I am not sure but I think the issue in both cases may be explained here:

What happens if you just do formula=habitat or formula=site+habitat?

Would you mind sharing your data so I could take a look? You can send to me in a DM if you do not want your data to be public here (I would need both the distance matrix and the metadata).


If I set formula to habitat, site+habitat, or site*habitat, it works and I can see their results. However, some of the R2 values changed from when I included 5 formulae (“animal+species+lifestage+site+habitat”). Does R2 change depending on the formulae included?

Btw, I DMed you the files. Thanks!

Hi @Alan_Chan,
Thank you for sharing your data. Indeed, I think the issue is that 1) you have limited degrees of freedom for testing such a complex formula and 2) many of your categories are nested, e.g., species is nested in animal, and site is nested in habitat. So adonis cannot test interactions between those factors, and cannot test for e.g., habitat effects after already taking site differences into account.

Note that formula order matters. So animal+species+lifestage+habitat+site works, but animal+species+lifestage+site+habitat skips habitat. However, since some of these factors are nested, you may want to either use a simpler formula (e.g., don’t use habitat and site simultaneously).

You should also pick and choose your interaction terms. E.g., even if you could look at all interactions between animalspecieslifestagesitehabitat, it would be exceedingly complicated to interpret what those 3-, 4-, and 5-way interactions really mean. You should be able to manually pick interaction terms with the “:” notation, e.g., to test these five factors and interaction between species and lifestage do “animal+species+lifestage+site+habitat+species:lifestage”

Yes. R2 is telling you effectively the % variation explained by that factor after accounting for other factors. So the order and content of your formula will effect the R2 of each factor.


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