Can ANCOM2 handle nested random effects as well?

Hi,

I have an experiment comparing the gut microbiota of fish fed different diets. Each diet was randomly allocated to 4 replicate tanks, each containing 30 fish. The experiment is a nested design, with tanks nested within diets.

This thread mentioned that ancom2 can handle random effects. Since ancom2 was designed to do differential abundance testing for longitudinal studies, I guess nested designs can also be dealt with? Is the following code correct for running differential abundance testing with one nested random effect?

ANCOM.main(OTUdat = OUT-table,
Vardat = metadata,
adjusted = F,
repeated = F,
main.var = “diet”,
adj.formula = NULL,
repeat.var = NULL,
longitudinal = F,
random.formula = “~1|tank”,
multcorr = 2,
sig = 0.05,
prev.cut = 0.90)

Any comments or helps are greatly appreciated!

Yanxian

Hi @yanxianl,

ANCOM 2 isn’t a tool in QIIME, so Ive moved this to the “other tools” category.

Best,
Justine

Hi @yanxianl,
Perhaps this overview paper of mixed/random effects models would be helpful, all the example codes are R-based so you should be able to figure out the proper formula you need from this. Hope it helps.

Hi Mehrbod,
Thanks for your comment! I’ve read that paper before. I’m just not sure if the ancom2 was designed to handle nested random effects as well. The examples given in the ancom2 documentation are all longitudinal studies. I’ll look at the source code.

Hi @yanxianl,
Sorry I couldn’t be more helpful! It’s been a while since I’ve used ANCOM2 myself personally, but a quick look at their source code shows that their model building uses the nlme package which does support both random and fixed effects. The ANCOM2 source code also doe appear to include random and fixed effects.

library(nlme)
?(nlme) # or
?(lme) 

Will show the appropriate syntax to use.
Good luck!

2 Likes