# MMUPHin-Adjust\_batch() error

**URL:** <https://forum.biobakery.org/t/mmuphin-adjust-batch-error/4234>\
**Category:** MMUPHin\
**Created:** [October 12, 2022, 6:10pm UTC](https://forum.biobakery.org/t/mmuphin-adjust-batch-error/4234 "2022-10-12T18:10:55Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nelly](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.biobakery.org/nelly/32/1718_2.png) [@Nelly](https://forum.biobakery.org/u/Nelly)\
**Post date:** [October 12, 2022, 6:10pm UTC](https://forum.biobakery.org/t/mmuphin-adjust-batch-error/4234/1 "2022-10-12T18:10:55Z")

</div>

Hello,

I am trying to adjust for batch effects between eleven microbiome studies and their relative abundance data using adjust\_batch() but am receiving the following error:

Error in MMUPHin::adjust\_batch(feature\_abd = CRC\_abd, batch = “study”, :  
Covariates and batch are confounded!

Is this means that there is some correlation between batches and covariates?

If this helps, I have twelve covariates. I’ve lowered covariates to five by combining some of them (because I thought that problem is that in one study there is more than one covariate) but I received the same error. Finally, when I change covariates into two categories (control and treatment) it works, but in the wrong way because it shows that there is no difference between the two covariates.

Any guidance would be appreciated! Thank you

---

<div class="post-metadata">

**Author:** ![andrewGhazi](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.biobakery.org/andrewghazi/32/2950_2.png) [@andrewGhazi](https://forum.biobakery.org/u/andrewGhazi)\
**Post date:** [October 13, 2022, 2:47pm UTC](https://forum.biobakery.org/t/mmuphin-adjust-batch-error/4234/2 "2022-10-13T14:47:33Z")

</div>

> Is this means that there is some correlation between batches and covariates?

Unfortunately it’s worse than that. Your batch and covariates are not just correlated, they are linearly dependent. To be more specific, the matrix whose columns are your batch and covariate variables is [not full rank](https://en.wikipedia.org/wiki/Rank_(linear_algebra)#Examples).

You could try looking at `model.matrix(~ <your batch variables> + <your covariates>, data = your_data)` to identify which columns are not independent and/or make sure the software is encoding your variables in the way you intend.

---

<div class="post-metadata">

**Author:** ![Nelly](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.biobakery.org/nelly/32/1718_2.png) [@Nelly](https://forum.biobakery.org/u/Nelly)\
**Post date:** [October 13, 2022, 9:34pm UTC](https://forum.biobakery.org/t/mmuphin-adjust-batch-error/4234/3 "2022-10-13T21:34:29Z")

</div>

Thank you so much,it was really helpful.
