# MaAsLin 3 model for paired samples across independent sampling days

**URL:** <https://forum.biobakery.org/t/maaslin-3-model-for-paired-samples-across-independent-sampling-days/9044>\
**Category:** MaAsLin\
**Created:** [August 25, 2026, 3:32pm UTC](https://forum.biobakery.org/t/maaslin-3-model-for-paired-samples-across-independent-sampling-days/9044 "2026-08-25T15:32:54Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![awu](https://avatars.discourse-cdn.com/v4/letter/a/41988e/32.png) [@awu](https://forum.biobakery.org/u/awu)\
**Post date:** [August 25, 2026, 3:32pm UTC](https://forum.biobakery.org/t/maaslin-3-model-for-paired-samples-across-independent-sampling-days/9044/1 "2026-08-25T15:32:54Z")

</div>

Hi,

I’m new with MaAslin3 and I was trying to figure out what would be the best setting for my analysis but after a lot of reading I’m still not clear. So I decided to ask here hoping that someone can help me.

I am analyzing a microbiome experiment with four sampling days (D1–D4). The microbiome of mice sampled on each day are different, so there are no repeated measurements of the same mouse across days. However, within each day, each mouse provides a paired control and ‘treated’ sample, meaning control and ‘treated’ samples are matched within mouse. Therefore, the data are paired within each day but independent between days. I have 5 paired samples within each day. I am considering using MaAsLin 3 and would like to ask what would be the ideal model specification for this design. Specifically, should I include `day`, `condition`, and the `condition × day` interaction as fixed effects, and use `mouse_id` as a random effect to account for the pairing within each day? Is this an appropriate way to test (1) whether taxa differ between control and treated overall and specially (2) whether the treatment effect changes across D1–D4. I would also appreciate advice on whether `day` should be treated as a categorical or continuous variable in this design. I also have a baseline data at D0 that would be a control but no ‘treated’ samples at D0. Could that be used as a reference group?

Thanks!

---

<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:** [August 25, 2026, 3:53pm UTC](https://forum.biobakery.org/t/maaslin-3-model-for-paired-samples-across-independent-sampling-days/9044/2 "2026-08-25T15:53:41Z")

</div>

Hi,

I don’t think I follow the description of the study, particularly how the data are independent between days. Are you saying that each day there was a different mouse sampled and therefore the days are independent? Otherwise, if each mouse was sampled repeatedly across multiple days, I’m not sure how the different days would have independent measurements.

If a mouse is sampled repeatedly, using `mouse_id` as a random effect is the right thing to do, and you’ll definitely want `condition` as a fixed effect. I’m not sure what to make of `day` yet.

Will

---

<div class="post-metadata">

**Author:** ![awu](https://avatars.discourse-cdn.com/v4/letter/a/41988e/32.png) [@awu](https://forum.biobakery.org/u/awu)\
**Post date:** [August 25, 2026, 7:04pm UTC](https://forum.biobakery.org/t/maaslin-3-model-for-paired-samples-across-independent-sampling-days/9044/3 "2026-08-25T19:04:35Z")

</div>

Hi,

Thank you for your quick response. Yes, because of the nature of the study, we are unable to sample the microbiome from the same mouse across different days. Each day therefore consists of a different set of mice. However, within each day, each mouse was sampled twice, providing a paired control and “treated” sample. Thus, the samples are paired within mouse within each day, but different mice were used across days.

Because of this particular design, I was also confused about how to handle the day variable. Since each mouse is sampled twice within a day, but mice are not sampled repeatedly across different days, can I still use `mouse_id` as a random effect to account for the pairing between the control and treated samples?

Alternatively, would it be more appropriate to treat D1, D2, D3, and D4 as four separate paired experiments and analyze each day separately? Or is it preferable to include all days in a single MaAsLin 3 model with `day` as a fixed effect and `mouse_id` as a random effect?

I would also like to determine whether the treatment effect changes across days, so I am wondering whether separating the days would prevent me from testing that interaction.

Thank you!

---

<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:** [August 26, 2026, 12:24am UTC](https://forum.biobakery.org/t/maaslin-3-model-for-paired-samples-across-independent-sampling-days/9044/4 "2026-08-26T00:24:05Z")

</div>

Is anything changing about the condition between the days? For example, was the condition applied on day 1 and therefore the different days are different lengths of treatment? If you’re using the same mouse as both control and condition on each day though, presumably not. If there’s nothing different between the days, the experiment would presumably be the same as if you had collected the samples from the two conditions per mouse for all the mice on the same day. If so, the formula to use would just be `condition + (1|mouse_id)` which will account for the fact that each mouse had 2 samples. If I’m misunderstanding and the `day` variable is still relevant, can you explain how and I might be able to give a better recommendation?

Will

---

<div class="post-metadata">

**Author:** ![awu](https://avatars.discourse-cdn.com/v4/letter/a/41988e/32.png) [@awu](https://forum.biobakery.org/u/awu)\
**Post date:** [August 27, 2026, 7:54pm UTC](https://forum.biobakery.org/t/maaslin-3-model-for-paired-samples-across-independent-sampling-days/9044/5 "2026-08-27T19:54:46Z")

</div>

Hi Will,

Sorry for not being clearer. Yes, the days represent different lengths of treatment. The treatment was applied on day 1 in all groups and microbiome samples were taken in different days.

I’m using the same mouse as control and treatment (Ex: a topical treatment, which allows me to sample the microbiome from the same tissue but different zones). Therefore, each mouse was sampled twice, generating paired control and treated samples.

Given this setup, the `day` variable is still relevant for me because I’m interested in whether the effect of the treatment changes with the length of treatment. My question is whether it would be appropriate to use `condition * day + (1 | mouse_id) `where `mouse_id` accounts for the pairing between the control and treated samples from the same mouse within days. Should I also take into account other parameters such as small\_random\_effects?

---

<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:** [August 28, 2026, 5:12am UTC](https://forum.biobakery.org/t/maaslin-3-model-for-paired-samples-across-independent-sampling-days/9044/6 "2026-08-28T05:12:27Z")

</div>

With that experimental design, if you have multiple mice per day, you should be able to fit the interaction model `condition * day + (1 | mouse_id)`, but if you only have one mouse per day, there’ll probably be too many terms for that model to fit and you’ll probably need to use the non-interacted version `condition + day + (1 | mouse_id)`. The interaction model will tell you how much the condition’s effect is changing per day whereas the non-interaction version will just control for the day effect. This is all assuming you use `day` as a categorical variable.

If you think the way in which `condition` and `day` interact is linear-ish (e.g. the effect of the condition is strongest at the beginning and just decays over time), you could use `day` as a continuous variable, which might allow the model to fit even if you only have one mouse per day. Still, you’ll probably have low power to detect an effect after multiple hypothesis correcting over all the interaction terms.

Either way, I’d use `small_random_effects` since you have 2 (\<=4) samples per mouse.

---

<div class="post-metadata">

**Author:** ![awu](https://avatars.discourse-cdn.com/v4/letter/a/41988e/32.png) [@awu](https://forum.biobakery.org/u/awu)\
**Post date:** [August 30, 2026, 7:14pm UTC](https://forum.biobakery.org/t/maaslin-3-model-for-paired-samples-across-independent-sampling-days/9044/7 "2026-08-30T19:14:10Z")

</div>

Hi Will,

I do have several mice per day.

Thank you so much for taking the time to reply! I really appreciate it!
