# Associate changes in taxa relative abundances (for all taxa) with calculated changes of continuous metadata variables

**URL:** https://forum.qiime2.org/t/associate-changes-in-taxa-relative-abundances-for-all-taxa-with-calculated-changes-of-continuous-metadata-variables/31218
**Category:** General Discussion
**Tags:** longitudinal
**Created:** [August 22, 2024, 4:38pm UTC](https://forum.qiime2.org/t/associate-changes-in-taxa-relative-abundances-for-all-taxa-with-calculated-changes-of-continuous-metadata-variables/31218 "2024-08-22T16:38:13Z")
**Posts on this page:** 1
**Showing post:** 3

<div class="post-metadata">

### Author: ![jwdebelius](https://forum.qiime2.org/user_avatar/forum.qiime2.org/jwdebelius/32/9655_2.png) [@jwdebelius](https://forum.qiime2.org/u/jwdebelius)
#### Post date: [August 28, 2024, 1:08pm UTC](https://forum.qiime2.org/t/associate-changes-in-taxa-relative-abundances-for-all-taxa-with-calculated-changes-of-continuous-metadata-variables/31218/3 "2024-08-28T13:08:22Z")

</div>

Hi @MARTIN_MIHULA and @bioinfx,

So, a few thoughts, for what they're worth.

First, this sounds like an interesting and complex experiment!

> [@bioinfx](#):
>
> **Goal** : I want to associate _changes_ in specific taxa over visits (independent variable) to concurrent _changes_ in other variables (dependent variables). E.g., to relate changes in taxa abundance from visit 1 to visit 2 (independent variable) to the change from visit 1 to visit 2 in resting heart rate (dependent variable). I want to do this for all my taxa (hundreds of individual statistical tests), similar to other exploratory approaches like differential relative abundance analysis.

Your goal doesn't align with the currently avalaible tools. I think we can accomplish the same thing, but you have to adjust your theoretical framework. I wrote about this a while ago when someone was struggling with relationships in their DAG.

> [@modeling bacterial features as indepedent variables](https://forum.qiime2.org/t/modeling-bacterial-features-as-indepedent-variables/25766):
>
> Hello community! One of the commonly used methods in this field is to test the association of each feature separately, using packages such as Maaslin2 and ANCOM-BC (which was recently added thanks to @lizgehret!). These packages enable the modeling of independent variables and testing each feature as the dependent variable. For example, if there are variables of weight, sex, and bacterial features, using Maaslin2/ANCOM-BC (as well as other packages and approaches), one can test the dependence o…

Because measures are contemporaneous, you have no way of knowing which came first: the change int he microbiome and the change in the overall physiology. You have a guess, but you don't know for sure. So, switch you model and remember that in a linear regression if y = mx + b, x = (y - b) / m.

This is especially true at this stage, where your p-value should be reasonably close regardless of the modeled relationship and you're essentially using the p-value as a cut-off for looking at your data.

> [@bioinfx](#):
>
> **Current problem** : I know that longitudinal microbiome data presents some unique statistical challenges, and benchmark papers (e.g., [here](https://www.nature.com/articles/s41522-020-00160-w)) suggest that statistical approach particularly matters with this kind of data to avoid an inflated FDR. I have been unable to find a tool (designed for 16S data) that allows me to control for visit 1 relative abundance of taxa _nor_ one that allows me to use calculated changes in relative abundance between timepoints (i.e., `V1V2_taxa_change`) as independent variables (testing all taxa individually). Ideally, I'd like to be able to do both of these things in the same tool.

This is basically a modeling problem. Its not an easy modeling problem, but its a modeling problem. You essentially want to model this as `y ~ m*t` which expands to `y ~ m + t + m:t`  
where

- _y_ is your dependent variable,
- _m_ is the change in y for each unit change in _m_ when _t_ = 0 - or the effect of your independent variable at baseline if _t_ is time.
- _t_ is the change in y for each unit change in _t_ when _m_ = 0 - or the effect of time alone on your depepent variable
- _m_:_t_ is the amount y changes for each unit change in m and t - how much does m change for over each time step.

The way you put the variables int he model - whether you treat t as continous or categorical, etc can determine how these predictors get put together. But, ultiamately, what you want is an interaction model. I'd find a statistican to work with on this one, if you have one avaliable, and youre still fuzzy.

> [@bioinfx](#):
>
> I've looked at the [longitudinal](https://docs.qiime2.org/2024.5/plugins/available/longitudinal/) plugin here, and it doesn't seem to quite do what I'm interested in--but I would love to be corrected if I'm mistaken.

This is exactly what the longitudinal plugin does for alpha and beta diveristy - again, flipping the direction because the direction of the equation matters less than you want it to.

Tool wise, I find @MARTIN_MIHULA's proposal interesting:

> [@MARTIN\_MIHULA](#):
>
> You can check a documentation of these two tools: MetagenomeSeq and MaAsLin2. Both of them have an option how to deal with longitudinal data. I think they are more appropriate for what you are trying to do than ANCOM-Bc.

ANCOM-BC 2, in R has the linear mixed effect framework with inmpeleted. Its just not avaliable in QIIME 2. Im not familiar with these, although Im not sure if thye use appropriate underlying models. I know the p-values in MaAsLin are a bear to work with. I would double check Table 1 from [Microbiome differential abundance methods produce different results across 38 datasets](https://www.nature.com/articles/s41467-022-28034-z/tables/1) which unfortunately does not include ANCOM-BC but will give you details about hte others.

Best,  
Justine

---

_[View the full topic](https://forum.qiime2.org/t/associate-changes-in-taxa-relative-abundances-for-all-taxa-with-calculated-changes-of-continuous-metadata-variables/31218)._
