Hello,
I have a data set that includes pre/post sequences (for which I termed the “trial” variable). MaAslin2 was a great tool to check for differences following the trial. However, I also want to look at gender differences as an interaction with the trial (so not just the overall difference in gender, which I believe would clump my pre/post data together).
I believe I would want an interaction term (am new to this kind of analysis). Am I correct in thinking that adding “Trial” and “Gender” as fixed effects would not give me the output I am looking for? I am having a hard time understanding the interaction tutorial.
Thank you!
You want an interaction effect if the combined effect of gender and trial goes above and beyond the effect of changing them individually. Simulated explanatory example:
If you decide you want to include an interaction variable, the model.matrix()
function in R can help set up the necessary metadata variables. Something like model.matrix(~gender*trial, data = d)
in your case.
On top of what @andrewGhazi said, once you create the interaction variable, you need to supply both the main variables as well as the interaction variable to MaAsLin 2 as fixed effects. You may want to subset your results table to the interaction term only and re-compute the q-values to reduce the burden of multiple testing but the above strategy should give you what you are looking for.
All the best,
Himel
Hello,
Thank you both for your help! I did have a followup questions. When I use the interaction terms, in my case it ended up being this,
fixed_effects = c(“SexMALE”, “TrialPRE”,“SexMALE:TrialPRE”),
only SexMALE and TrialPRE ended up in the results. Am I miss understanding or should the interaction be included in the results?
Thanks again,
Cassie
You need to make sure the interaction metadata variables are in your input metadata. Example from the Maaslin2 tutorial: MaAsLin2 · biobakery/biobakery Wiki · GitHub