Best approaches/model for longitudinal differences in taxa abundance?


I am working with some longitudinal samples from animals, where I want to see if different diets affect the relative abundance of any specific genera. I am planning to use “qiime longitudinal feature-volatility” to identify some specific taxa to test with “qiime longitudinal linear-mixed-effects”. I have a few questions about this approach.

  1. Is feature-volatility a good approach to identify these taxa? I also considered ANCOM but couldn’t figure out how to incorporate the longitudinal design in that test.

  2. Should I use a rarefied feature table to generate the feature table of relative abundances? For relative abundance I normally would not, but in this particular case, I know that library size is significantly different in my samples from different times.

  3. How do I interpret the accuracy-results.qza file? Mine don’t look like the example from sample-classifier; I don’t have a confusion matrix. If the p-value is significant, does this mean the model is accurate?

  4. When including random slopes in linear-mixed-effects with --p-random-effects, do these slopes apply to individual subjects over time, or to each group as defined by the fixed effects (–p-group-columns)?


Yes — though you may want to separate by diet if you expect large differences between different diets. feature-volatility is a good technique for exploring any kind of longitudinal data — but linear mixed effects models might not be a good choice if you do not expect very linear changes (feature volatility will help you decide). One issue with this technique will be if you do not have very strong temporal signal, but it is worth a try.

You can do so in R, but not with the implementation of ANCOM that is currently in QIIME 2 (we are working to support longitudinal and paired tests in the future!)

I’d recommend using feature-volatility to explore the data, and then either use longitudinal ANCOM outside of QIIME 2 or use the volatility plots to identify time points when diet appears to have a profound impact on microbial composition, and then use QIIME 2 ANCOM just at that time point to compare diet effects.

No, you do not need to. The random forest models are quite robust to sequence depth.

Use the R2 and MSE and plot to assess goodness of fit. There will not be a confusion matrix, it should be a scatter plot. The arbitrary line shows the expected 1:1 trend… if your predictions scatter roughly about that line, your model is good. If not, there may not be very strong temporal signal. That model is built on everything, so you may want to separate your table by diet and run on diet types one by one initially to find features that best predict time for each diet.

Good question — I believe these would apply to individual subjects. Differences in group slope are already accounted for since diet * time would be used as fixed effects.

I hope that helps!

1 Like

Hi Nicholas,

Thanks for your reply, this is super helpful. A couple of follow-on questions to be sure I’m understanding correctly:

Would you still recommend ANCOM (either longitudinal or per-time point) if I only expect < 10 genera out of 100+ to be different between treatments? From comparing treatments at each time point individually, the multiple test correction seems to kill anything that might be significant.

I tried testing one genus with LME both with and without random slopes, and was surprised to find that including the random slopes transformed a significant result to a very not-significant one. Maybe this question is beyond the scope of this forum, but do you have any insights or suggested reading that might help me understand why including random slopes has such a big effect on the results, and how to interpret this? If allowing individual animals to be modeled with different slopes (= different responses to diet) makes significant differences between diet groups disappear, does this mean that the response of individuals (even those eating the same diet) is highly heterogeneous? I can post the results of these two models if you think it might be helpful.


Yes! One of the assumptions of ANCOM is that few features are significant (less than ~25%).

Don’t test every individual time point… that’s when a longitudinal method is useful. Instead, I am assuming that there will only be ONE time point (or maybe a small number) where there are clear differences. If this is a diet study where all animals have the same diet at baseline, test at baseline (to prove no difference, e.g., cage effects), and test again at some peak period after the diet began when you see a strong effect (using e.g., volatility charts to identify this point).

Changing up the effects structure is expected to have dramatic impacts — but in general you should exclude effects that are not significant in your final model. Interpretation is highly subjective to the experiment, so you would be best consulting with a statistician, but you can post here and I will see if I can shed light on this. Use volatility plots to decide whether you think individual animals have heterogeneous slopes or not, and fit the model accordingly.


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