q2 longitudinal linear mixed effects model random effects

Hello qiime2 universe!

I’m using the q2 longitudinal plugin for the first time, as I was looking for a solution for repeated measures analysis of beta diversity data (over 3 timepoints) and understood that PERMANOVA was not going to cut it.

The pipeline I am doing is this:

  1. qiime longitudinal first-distances

  2. qiime longitudinal linear-mixed-effects

The piece that I am uncertain about is that I want the individual ID to be the random effect, but I am uncertain if I add that under --p-random-effects or not.

In the help it says the following:

--p-random-effects TEXT Comma-separated list (without spaces) of metadata
columns to use as independent covariates used to
determine the variance and covariance structure
(random effects) of "metric". To add a random slope,
the same value passed to "state-column" should be
passed here. A random intercept for each individual
is set by default and does not need to be passed
here.

But when I run the code without subject ID as an explicit random effect, subject ID is not listed as a random effect. For a sanity check I ran it once with subject ID as random effect and once without (with the assumption it does at default) to compare and I did get slightly different results… I don’t want to be in a situation where I am accidentally adding subject ID as a random effect twice?

TLDR; when running linear mixed effects model with q2 longitudinal, after running first distance, does one explicitly state subject ID as a random effect (like how you would do when running lme in R) or is this already accounted for within this model in qiime2?

many thanks for your help :folded_hands:

Zoë

2 Likes

Hi @zippyzo ,

Great question. If no random effects are explicitly passed, individual ID is indeed used as a random effect by default. This is the default behavior of the LME implementation in statsmodels (individual ID is used as the grouping variable, which is used as a random effect by default). However, from those docs it sounds like if you are passing other random effects then individual ID would not be used unless if it is explicitly passed.

I hope that helps clarify!

3 Likes

Hello Nicholas,

This makes sense and is incredibly helpful! Thank you so much for the clarification.

kindest regards,

Zoë