Random versus fixed effects

Hello,

First of all, thank you so much for developing MaAsLin and for your continuous help to the community! I am using MaAsLin3 to analyze my metagenomics dataset and I am a bit unsure on how to proceed with the specification of my model.

My dataset contains 3 disease groups (control, disease_group1, disease_group2). Each participant in my study belongs to one of these groups, and each participant provided up to three samples (each one on separate days). I am interested in studying the differences between the three groups, especially in comparing controls to disease_group1 and disease_group2, and also disease_group1 to disease_group2.

As far as I understand, I should run the model using the formula ~ disease_group + covariates + (1 | participant_id), where covariates include variables like batch, ethnicity, diet, etc. However, when I do that I get no significant results at all. After reading the documentation in the package github repository, I found this part:

  • random_effects: A vector of variable names to be included as random intercepts. Random intercept models may produce poor model fits when there are fewer than 5 observations per group. In these scenarios, per-group fixed effects should be used and subsequently filtered out. (See strata_effects as well.)
    • Random effects models are fit with lmer (linear) and glmer (logistic), and the significance tests come from lmerTest and glmer respectively.

As I have up to 3 samples per participant_id, I thought this statement may apply to my case. So, I tried to specify the model as ~ disease_group + covariates + participant_id and in this case I did get a bunch of significant results, many of which make sense biologically. I also tested using the small_random_effects option, but if I understand correctly that only applies to the logistic model part.

So, my questions are:

  • In my setting, is it correct/appropriate to use participant_id as a fixed effect?
  • Since each participant will always have the same values for other covariates like ethnicity, diet, etc, should I skip them from the model specification when using participant_id as a fixed effect?

Thank you so much for your help!

1 Like

Hi,

  1. Yes, it’s always valid to use participant ID as a fixed effect instead of random effect. People often try to use it as a random effect to get more power, but if you’re getting significant results with it as a fixed effect you’re probably in good shape. It’s worth checking the small_random_effects option since that’ll use the same fixed effect for logistic regression but apply the participant ID as a random effect in the linear regression. If you get the same results with participant ID as a fixed effect and with participant ID as a small_random_effect, you can probably use either model, but if you end up with quite different sets of significant features, it’s worth figuring out why.
  2. Regardless of whether you use participant ID as a fixed or random effect, if there are other covariates that are always the same per participant ID, you can skip them in the model specification since they’ll be collinear with the participant ID (and therefore already controlled for with the participant ID).

Will

1 Like