MaAsLin2 and model.matrix variables

Hello,

I am trying to find if my treatment affects the abundance of bugs in males vs females differently, so I want to incorporate an interaction term.

For the diversity models, I used-

mixed(simpson ~ Sex+
Treatment + Sex*Treatment+(1|ID), data = df,
method=“S”, type=“3”)

I want to replicate something like this in MaAslin2. Is this possible? I saw another post saying to use model.matrix(), which I did and was able to make my three variables. I was able to put these three variables into MaAsLin2-

Results = Maaslin2(
input_data = data,
input_metadata = meta,
output = “output”,
fixed_effects = c(“SexMALE”, “TreatmentA”, “interaction”),
random_effects = c(“ID”),
analysis_method = “LM”,
normalization = ‘TSS’,
standardize = TRUE,
min_prevalence = 0.15,
min_abundance= 0.1)

This gave back data for each term, which I then re-filtered to get new q-values. However, when I went to graph the bacteria, they seemed very off. Meaning, bacteria it gave me for the interaction showed no difference in male and female outcomes, i.e., they had the same averages following the treatment. However, the coef MaAslin gave me were all above 2. It also gave me bacteria which seemed incorrect for my other factors as well.

I do not 100% trust the result it gave me. Does model.matrix work in this regard? Or is there something else I’m missing that is causing MaAsLin to run it incorrectly?

Thank you.

Hi @Evelyn

Thanks for reaching out. Based on my best information about your post it seems you set up your interaction effectively as discussed in this post here: MaAslin2 Interactions with Gender and Trial - #2 by andrewGhazi

As for why Maaslin is indicating coefs that don’t seem to match up with your data. Have you tried plotting the data out by the interaction variable itself? (i.e. plotting male+treatmentA vs. male+treatmentB, female+treatmentA, female+treatmentB). This should give you an idea of whether or not the results make sense.

Cheers,
Jacob Nearing