# Does the order of variables matter in ANCOM-BC

**URL:** https://forum.qiime2.org/t/does-the-order-of-variables-matter-in-ancom-bc/29818
**Category:** User Support
**Tags:** ancom-bc
**Created:** [April 7, 2024, 5:07pm UTC](https://forum.qiime2.org/t/does-the-order-of-variables-matter-in-ancom-bc/29818 "2024-04-07T17:07:48Z")
**Posts on this page:** 1
**Showing post:** 10

<div class="post-metadata">

### Author: ![colinbrislawn](https://forum.qiime2.org/user_avatar/forum.qiime2.org/colinbrislawn/32/6221_2.png) [@colinbrislawn](https://forum.qiime2.org/u/colinbrislawn)
#### Post date: [April 12, 2024, 5:22am UTC](https://forum.qiime2.org/t/does-the-order-of-variables-matter-in-ancom-bc/29818/10 "2024-04-12T05:22:39Z")

</div>

I tried running this with data from [PD-mice](https://docs.qiime2.org/2024.2/tutorials/pd-mice/#differential-abundance-with-ancom-bc)

In this example, donor and genotype are fully blocked and perfectly balanced:

```sh
$ cut -f 4,6 metadata.tsv | sort | uniq -c
      1 categorical categorical
      1 genotype donor
     12 susceptible hc_1
     12 susceptible pd_1
     12 wild type hc_1
     12 wild type pd_1

```

```sh
qiime composition ancombc \
  --i-table table_2k_abund.qza \
  --m-metadata-file metadata.tsv \
  --p-formula 'donor + genotype' \
  --o-differentials ancombc_donor_first.qza

qiime composition ancombc \
  --i-table table_2k_abund.qza \
  --m-metadata-file metadata.tsv \
  --p-formula 'genotype + donor' \
  --o-differentials ancombc_genotype_first.qza

# Then qiime composition da-barplot to make these:

```

[ancombc\_genotype\_first.qzv](https://forum.qiime2.org/uploads/short-url/cv6LQNOZV9L33jDu8k0o9mXPUPU.qzv) (222.0 KB)  
[ancombc\_donor\_first.qzv](https://forum.qiime2.org/uploads/short-url/Acgd3sbHdAzL35Vado1toryzncH.qzv) (222.0 KB)

On first inspection, these look the same...

Remember that

- this study is fully blocked (no confounding factors) and
- all cohorts are balanced (n = 12 for subgroups)
- which is cleaner than most real studies! 🫠

What I _don't_ have is a citation that says formula order doesn't matter.

Remember that different packages run different tests, so [formula order can absolutely matter!](https://forum.qiime2.org/t/interpretation-beta-diversity-permdisp-adonis/21856/)

---

_[View the full topic](https://forum.qiime2.org/t/does-the-order-of-variables-matter-in-ancom-bc/29818)._
