 # Repeated measured diversity statistical testing

Hi all!

Are there any ways to run repeated measures alpha/beta diversity statistical tests in QIIME2? I’m somewhat familiar with ways to run a few relevant ones in Python and R, but I’m helping a collaborator with no Python/R knowledge set up a QIIME2 pipeline (to be executed in Jupyter notebook) for a series of studies.
To make future troubleshooting easier, I’m trying to keep everything that could possibly be run as QIIME commands run as such, rather than having my collaborator transition to Python/R. If needed, I can include some Python code, but I’d rather not use R (to decrease the need for rpy2 or having them download and switch to R halfway through analyses - mostly trying to minimize any potential issues down the line).

Additionally, I have a few questions about the best ways to perform repeated measures tests for alpha and beta diversity.

1. Alpha group significance
I was hoping to use a Friedman test as a non-parametric alternative to a repeated measures ANOVA or a repeated measures ANOVA on ranks, but are there other ways (potentially in QIIME) to do so that I could be missing?

2. Alpha correlation
I was hoping to use a repeated measures correlation. Is this possible in QIIME2, maybe through the longitudinal plugin?

3. Beta group significance
Is calculating participant centroids and then performing PERMANOVA/Adonis the best way to do this? If so, what is a reliable way to calculate centroids? I know that you can get centroids from permdisper, but I’m trying to stay in Python if possible, and I haven’t seen any way to get centroids in skbio. Are the centroids that permdisper uses the geometric means of the PCoA coordinates? If so, I can do that, but is there any way to calculate centroids in QIIME?

4. Beta correlation
This is the one I’m most unsure about. How should I approach a Mantel Test with non-independent samples?
From my understanding (please correct me if I’m wrong here!), the mantel test first calculates the correlation between the two distance matrices and then permutes the data and calculates the p value based on the portion of permutations with better correlation coefficients. Would there be any way to perform this with a repeated measures correlation, rather than Pearson/Spearman?

Thanks a lot!
-John

1 Like

Hi @sterrettJD ,

You should check out the q2-longitudinal plugin (and the tutorial for it at docs.qiime2.org/). Linear mixed effects models are probably a good choice for you. This would work for alpha diversity or beta diversity (PC coordinates or first distances, see tutorial) as the dependent variable, and some combination of categorical and/or numeric factors as independent variables.

q2-longitudinal also has an ANOVA method… it currently does not support repeated measures ANOVA but it would be pretty straightforward to expose this option if you want to contribute a pull request (since it sounds like you are already familiar with how to do this in python/R )

PERMANOVA is not really meant for repeated measures data… check out the original PERMANOVA papers from Anderson for more details, but I believe there are issues with autocorrelation and it should not be used for this.

No

Good luck!