# Maaslin2 correlation plot doesn't match data

**URL:** <https://forum.biobakery.org/t/maaslin2-correlation-plot-doesnt-match-data/6152>\
**Category:** MaAsLin\
**Created:** [October 30, 2023, 9:27pm UTC](https://forum.biobakery.org/t/maaslin2-correlation-plot-doesnt-match-data/6152 "2023-10-30T21:27:53Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![dlepp](https://avatars.discourse-cdn.com/v4/letter/d/53a042/32.png) [@dlepp](https://forum.biobakery.org/u/dlepp)\
**Post date:** [October 30, 2023, 9:27pm UTC](https://forum.biobakery.org/t/maaslin2-correlation-plot-doesnt-match-data/6152/1 "2023-10-30T21:27:53Z")

</div>

I’m using maaslin2 v1.8.0 and am a bit confused with the scatterplots that are output. I am comparing 16S relative abundance data with a continuous variable, and for a particular species, if I just plot the relative abundances with the variable, there is a clear positive correlation.

However, after running maaslin2 without normalization or transformation, setting the variable as the fixed effect and no random effects, and using either the LM or CPLM methods, the scatterplot appears quite different, with a slightly negative, non-significant correlation. I have tried to upload png images of the plots, but am getting an error.

Should I assume my data is getting mixed up at some step, or is there a possible explanation for this behaviour? I’ve tried looking at the “fitted” dataframe, but I’m not sure how to relate it to my original data. Any help is appreciated.

Thanks,

Dion

---

<div class="post-metadata">

**Author:** ![nearinj](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.biobakery.org/nearinj/32/2135_2.png) [@nearinj](https://forum.biobakery.org/u/nearinj)\
**Post date:** [November 1, 2023, 7:55pm UTC](https://forum.biobakery.org/t/maaslin2-correlation-plot-doesnt-match-data/6152/2 "2023-11-01T19:55:27Z")

</div>

Hi @dlepp,

That is an odd issue. Maaslin does a number of checks to insure that data is not mixed up when its input into the main function so I don’t think that this could be the case. If you wanted to dig into the data deeper you could set `-j TRUE` flag and inspect the output models for your variable of interest to see if something odd is going on. Although it’s hard to tell without seeing the graphs here.

Cheers,  
Jacob Nearing

---

<div class="post-metadata">

**Author:** ![dlepp](https://avatars.discourse-cdn.com/v4/letter/d/53a042/32.png) [@dlepp](https://forum.biobakery.org/u/dlepp)\
**Post date:** [December 19, 2023, 4:02am UTC](https://forum.biobakery.org/t/maaslin2-correlation-plot-doesnt-match-data/6152/3 "2023-12-19T04:02:52Z")

</div>

Hi Jacob,

Apologies for the very slow response - I’ve attached plots of the raw data (species abundance vs variable) and the maaslin results.

I’m not sure where to set the -j flag, can you please explain?

 ![correlation](https://canada1.discourse-cdn.com/flex027/uploads/biobakery/original/2X/1/1b821934f879849b57dceceeaf9ad65bd0a9cd9a.png)  
 ![maaslin2_correlation](https://canada1.discourse-cdn.com/flex027/uploads/biobakery/original/2X/f/fff777aead03c0899fc2c40ef7f6226f8a91fed4.png)

Thanks!

---

<div class="post-metadata">

**Author:** ![nearinj](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.biobakery.org/nearinj/32/2135_2.png) [@nearinj](https://forum.biobakery.org/u/nearinj)\
**Post date:** [December 21, 2023, 8:17pm UTC](https://forum.biobakery.org/t/maaslin2-correlation-plot-doesnt-match-data/6152/4 "2023-12-21T20:17:48Z")

</div>

Hi @dlepp,

Those are indeed very large differences between the two plots… I’m assuming in both cases the Y axis is proportional abundance?

Sorry about the confusion on the -j flag. That is for if you are calling maaslin2 from the command line. If you are calling it within R you can save the models using `save_models` parameter and setting it to `TRUE`.

You can then load up the .RDS file it saves as described here: [GitHub - biobakery/Maaslin2: MaAsLin2: Microbiome Multivariate Association with Linear Models](https://github.com/biobakery/Maaslin2#output-files)

Once loaded look at the model associated with the taxon of interest and check out if the metadata coefficient is going in the direction you expect.

Cheers,  
Jacob
