The bioBakery help forum

MassLin2: is there a limited number of fixed effects?

Hello bioBakery help forum,

I am trying to use Maaslin2 to look for associations between my two datasets: microbial species (n=255) and dietary variables (n=38). In the script, I had assigned the dietary variables as fixed_effects, and BMI and energy consumption as random_effects. However, there is an error message:
“Error in value[3L] :
Invalid formula. Please provide a different formula: expr ~ Bread_wholegrain(kcal) +…”

Do you know if this may be a limited number of fixed effects (or in this context, dietary variables) in the formula?

Many thanks in advance for your attention,
Dorrain

I would like to add that I am referring to the methodology in this recent paper (https://doi.org/10.1038/s41591-020-01223-3) to guide my analysis. In the section of statistical analysis, the dietary variables and covariables were input as fixed effects. May I clarify if the model was (or should be) ran for each dietary variable as a separate model or with a combination of all the dietary variables (i.e., MedDiet. whole grains, vegetables, etc)?

Hi @DorrainLow,

MaAsLin should be able to handle a large number of covariates. I have run it with at least n= 40 and been fine. Therefore, without a toy dataset with a minimally reproducible error of what you are observing, I can’t be 100% sure what the issue is. If that is not possible, can you provide the code you used to run MaAsLin? That may help me as well.

As to the second point, if you run the model with all of these fixed effects it runs them in combination. See the second part of this post for more information.

Best,
Kelsey