# Interaction term missing from Maaslin2 output

**URL:** <https://forum.biobakery.org/t/interaction-term-missing-from-maaslin2-output/6797>\
**Category:** MaAsLin\
**Created:** [March 15, 2024, 9:18am UTC](https://forum.biobakery.org/t/interaction-term-missing-from-maaslin2-output/6797 "2024-03-15T09:18:08Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jan](https://avatars.discourse-cdn.com/v4/letter/j/ce7236/32.png) [@Jan](https://forum.biobakery.org/u/Jan)\
**Post date:** [March 15, 2024, 9:18am UTC](https://forum.biobakery.org/t/interaction-term-missing-from-maaslin2-output/6797/1 "2024-03-15T09:18:08Z")

</div>

> packageVersion(“Maaslin2”)  
> [1] ‘1.15.1’

Hi,

One of my interaction variables is missing from Maaslin2 output, and I hope you guys can help me understand this and explain how to solve the problem.

I have a dataset consisting mainly of paired patient samples (“Ls\_before” and “Ls\_after” treatmen; for some patients there is only a single sample), but also seven female control samples. The patient samples are from both men and women.

The main variable of interest is “sampleType” (three levels: “Ls\_before”, “Ls\_after”, and “control”), but I also want to control for within subject correlations (using the variable “patient”) and include “Gender” as well as interaction terms for "sampleType " and “Gender”. The corresponding formula is thus: ~ sampleType + Gender + patient + sampleType:Gender

The interaction terms (“Ls\_after\_female” and “control\_female”) have been included in the metadata table using the model.matrix function.

In the results output, I find results for all variables/factor levels except control\_female (ie sampleTypeLs\_after, sampleTypecontrol, GenderFemale and Ls\_after\_female are present).

Any explanations or suggestions are greatly appreciated.

Sincerely,  
Jan

```auto
fit_data <- Maaslin2(
    input_data = input_data,
    input_metadata = metaData_reordered,
    output = "Maaslin2_output",
    min_abundance = 0.0,
    min_prevalence = 0.1,
    min_variance = 0.0,
    normalization = "TSS",
    transform = "LOG",
    analysis_method = "LM",
    max_significance = 0.25,
    random_effects = "patient",
    fixed_effects = c("sampleType", "Gender", "Ls_after_female", "control_female"),
    correction = "BH",
    standardize = TRUE,
    cores = 6,
    plot_heatmap = TRUE,
    plot_scatter = TRUE,
    heatmap_first_n = 50,
    reference = "sampleType,Ls_before;Gender,Male"
)

```

---

<div class="post-metadata">

**Author:** ![WillNickols](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.biobakery.org/willnickols/32/3223_2.png) [@WillNickols](https://forum.biobakery.org/u/WillNickols)\
**Post date:** [November 1, 2024, 4:24pm UTC](https://forum.biobakery.org/t/interaction-term-missing-from-maaslin2-output/6797/2 "2024-11-01T16:24:49Z")

</div>

Hi Jan!

If `control` and `female` are both the first factor levels for those metadata, those terms won’t show up in the output since they serve as the baseline to which the other factor levels and interactions are compared. For example, the fit `Gender` coefficient gives you the difference between male and female in your model; there won’t be one coefficient for `female` and one for `male`.

Will
