Longitudianl analysis with continuous variables

I have a question about longitudinal analysis.
I have a cohort of patients whose stool samples were collected at two time points, before and after a therapeutical intervention.
Thanks to the qiime longitudinal plugin (through the commands pairwise-distances and pairwise-differences), I have been able to perform pairwise comparisons between the two time points for my paired samples, grouping for the categorical variables of my dataset .
I am wondering how can I explore the relationship between alpha/beta diversity measures and the continuous variable of my metadata, always in a longitudinal optic.
Thank you very much,
Alessandro Lazzaro

Hi @Alessandro_Lazzaro,
Have you seen the q2-longitudinal tutorial yet? If not, I strongly recommend it. In particular you’ll want the qiime longitudinal linear-mixed-effects action which can take in the output of both pairwise distance or pairwise-difference which you already have made as response variables, and your independent variables can be numeric or categorical. Check those out and let us know if you run into any problems.

Hi @Mehrbod_Estaki,
thank you for your kind answer.
Yes, I saw the q2-longitudinal tutorial, but unfortunately I fear that it is not giving the answer I need.
As you said, the qiime longitudinal linear-mixed-effects command allow the use of both categorical as well as numeric variables, but always considering the latter as categorical and not continuous (a factor variable containing numeric values as “0”,“1”,“2”,“3”…will be treated as a categorical variable whose bins correspond to the numeric values); and it takes sense for me since the purpose of those command is to compare groups along time.
I am looking for a command which allow me to assess for correlation between numeric continuous variables and microbiome diversity measures along time.
Thank you

Hi @Alessandro_Lazzaro,
The --p-group-columns should recognize your 1, 2, 3, 4 column as numeric. If this is not happening, this is unexpected behavior and the developers would have to look into under the hood. Could you please provide us with the visualization artifact that you have that is showing these as categorical instead? The metadata would also be useful, if you can’t share that for some reason feel free to DM that.

Hi @Mehrbod_Estaki,
unfortunately I am not able to produce any artifact when I try to run the linear-mixed-effect with numeric continuous variables. I only obtain the following error:
Plugin error from longitudinal:
invalid index to scalar variable.
This following is the command that I am trying to run (on qiime2-2020.2):
qiime longitudinal linear-mixed-effects
–m-metadata-file ABC_W0_W24_less_ZIM015.txt
–m-metadata-file core-metrics-results/shannon_vector.qza
–p-metric shannon
–p-group-columns CD4_PERC,VIRAL_LOAD
–p-state-column WEEK
–p-individual-id-column PID
–o-visualization linear-mixed-effects.qzv

I tried with one continuous variable only or more at the same time, but with the same error. Also, the command performs without issues with categorical variables.
In attachment the dataset that I am working with.
Thank you very much for your help,

ABC_W0_W24_less_ZIM015.txt (190.6 KB)

1 Like

Thanks for sharing your data, @Alessandro_Lazzaro

This is not an issue with LME, and we had not seen this error previously (because it related to a quirk of your data, not the use of numeric fixed effects). It is a now-fixed bug in seaborn (the package that is used for plotting the diagnostic plots in the LME visualization): https://github.com/mwaskom/seaborn/issues/1949

This is fixed in the latest release of seaborn, which is included as part of the upcoming June release of QIIME 2… so if you can wait just a few more days this will work in the next release (I have confirmed this using your sample metadata file). if you can’t wait the next few days, you could try upgrading seaborn to version 0.10.1 in your conda environment where qiime 2 is installed.

I hope that helps!


Thank you very much for your answer @Nicholas_Bokulich !

Once released, where will I be able to find the new upcoming version?

Also, if I did understand how LME works, I would be able to use it with one continuous variable alone for a univariate analysis as well as with multiple variables of different types for multivariate analysis. Is that correct?

Thank you again!

Just follow the installation instructions at qiime2.org to create a new conda environment with the latest version of QIIME 2.

Sort of. Since q2-longitudinal is designed for longitudinal analysis, it is set up so that there is always at least one continuous variable (“state”). So you could use linear-mixed-effects with only one continuous variable and “state” could be anything, not just time (e.g., could be distance, etc). Then layer on as many fixed and random effects as you like, or none. So I think the short answer to your question is “yes”.

1 Like