# Trying to understand coef column (and how to convert it to fold change)

**URL:** <https://forum.biobakery.org/t/trying-to-understand-coef-column-and-how-to-convert-it-to-fold-change/3136>\
**Category:** MaAsLin\
**Created:** [February 15, 2022, 2:33pm UTC](https://forum.biobakery.org/t/trying-to-understand-coef-column-and-how-to-convert-it-to-fold-change/3136 "2022-02-15T14:33:43Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![dts](https://avatars.discourse-cdn.com/v4/letter/d/8491ac/32.png) [@dts](https://forum.biobakery.org/u/dts)\
**Post date:** [February 15, 2022, 2:33pm UTC](https://forum.biobakery.org/t/trying-to-understand-coef-column-and-how-to-convert-it-to-fold-change/3136/1 "2022-02-15T14:33:43Z")

</div>

Hi everyone!

I just performed an expression analysis with transcripts, and I’m trying to understand what exactly means “coef” column. I read in the Tutorial this:

`coef` : the model coefficient value (effect size).

So, ok, it’s the effect size, but I’m used to read about fold changes and log2 fold changes in this kind of analyses. So how can be this coefficient value transformed to fold change (in case this coefficient wasn’t fold change, which is a possibility I don’t discard)?

If it helps, I used these parameters:  
transform = “LOG”, analysis\_method = “LM”, correction = “BH”, normalization = “TSS”, standardize = FALSE

Thank you very much in advance.

---

<div class="post-metadata">

**Author:** ![mrgambero](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.biobakery.org/mrgambero/32/1227_2.png) [@mrgambero](https://forum.biobakery.org/u/mrgambero)\
**Post date:** [February 17, 2022, 10:03pm UTC](https://forum.biobakery.org/t/trying-to-understand-coef-column-and-how-to-convert-it-to-fold-change/3136/2 "2022-02-17T22:03:14Z")

</div>

Hello, I am also interested in this post. Thanks a lot, Gabri

---

<div class="post-metadata">

**Author:** ![Kelsey\_Thompson](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.biobakery.org/kelsey_thompson/32/65_2.png) [@Kelsey\_Thompson](https://forum.biobakery.org/u/Kelsey_Thompson)\
**Post date:** [February 18, 2022, 4:26pm UTC](https://forum.biobakery.org/t/trying-to-understand-coef-column-and-how-to-convert-it-to-fold-change/3136/3 "2022-02-18T16:26:23Z")

</div>

Hi @dts (and @mrgambero),  
Thanks for the question! In a previous response, we showed how to convert the [coef to log2 fold change](https://forum.biobakery.org/t/coefficient-in-maaslin2-output/2058). This is also something that we are thinking of implementing more clearly in the next major iteration of MaAsLin. We haven’t done it to date because it is confusing to implement/interpret within the multivariable infrastructure of MaAsLin. In the future, we are thinking of allowing a call for the main variable of interest within the model which will allow the results of a log2 fold change to be more interpretable.  
I hope this helps!  
Kelsey

---

<div class="post-metadata">

**Author:** ![mrgambero](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.biobakery.org/mrgambero/32/1227_2.png) [@mrgambero](https://forum.biobakery.org/u/mrgambero)\
**Post date:** [February 18, 2022, 9:15pm UTC](https://forum.biobakery.org/t/trying-to-understand-coef-column-and-how-to-convert-it-to-fold-change/3136/4 "2022-02-18T21:15:04Z")

</div>

Thanks @Kelsey_Thompson !

I am sorry to be annoying, but I still have doubts about how to do that.  
That question explains how to convert the coefficient to log2fold change in case of a glm with poisson distribution. But I usually use either 'lm" or “negative binomial”. Would that be the same?

I think in case of lm, I do not need to do the following step:  
fc\<- exp(fit$coefficients[2]) ## Antilog coef #2

What about negative binomial?

Thanks for considering this implementation for the future.  
I think it is a good idea to have it has fold change, so it is better quantifiable.  
Now we have this coefficient but we do not really know how to biologically interpret it.

I thank you in advance and for your awesome work!!  
Gabri

---

<div class="post-metadata">

**Author:** ![himel.mallick](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.biobakery.org/himel.mallick/32/1757_2.png) [@himel.mallick](https://forum.biobakery.org/u/himel.mallick)\
**Post date:** [February 18, 2022, 9:30pm UTC](https://forum.biobakery.org/t/trying-to-understand-coef-column-and-how-to-convert-it-to-fold-change/3136/5 "2022-02-18T21:30:54Z")

</div>

Hi @mrgambero - it’s the same as the Poisson GLM for the negative binomial. In fact, you can use the same formula for any GLM with a log link. Thanks!

---

<div class="post-metadata">

**Author:** ![dts](https://avatars.discourse-cdn.com/v4/letter/d/8491ac/32.png) [@dts](https://forum.biobakery.org/u/dts)\
**Post date:** [February 21, 2022, 10:45am UTC](https://forum.biobakery.org/t/trying-to-understand-coef-column-and-how-to-convert-it-to-fold-change/3136/6 "2022-02-21T10:45:13Z")

</div>

Thank you both! It helped a lot. I saw that previous response, but I was not sure at all if it would fit for the parameters I was using (in fact, I deduce from @himel.mallick answer that this formula is not proper for linear model, right?). Now I changed the analysis\_method to CPLM and transform to NONE, and following the formula I guess I get the log2 fold change correctly.

Thanks again, and keep on doing your excellent job.

---

<div class="post-metadata">

**Author:** ![himel.mallick](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.biobakery.org/himel.mallick/32/1757_2.png) [@himel.mallick](https://forum.biobakery.org/u/himel.mallick)\
**Post date:** [February 21, 2022, 5:14pm UTC](https://forum.biobakery.org/t/trying-to-understand-coef-column-and-how-to-convert-it-to-fold-change/3136/7 "2022-02-21T17:14:58Z")

</div>

Thanks, all. Just to add to the rationale for not doing a similar back transformation for linear models: with a log2 transformation in place (default in MaAsLin 2, similar to limma), the coefficients can be interpreted as the log2 fold-changes themselves, as explained [here](https://www.biostars.org/p/84487/). Note that, the interpretation is not quite the same without a log2 transformation for a linear model. This goes back to @Kelsey_Thompson’s comment on why we opted to report coefficients instead which are generally more universal across models and they are likewise much easier to interpret in our multi-model, multivariable setup.

---

<div class="post-metadata">

**Author:** ![mrgambero](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.biobakery.org/mrgambero/32/1227_2.png) [@mrgambero](https://forum.biobakery.org/u/mrgambero)\
**Post date:** [February 21, 2022, 7:22pm UTC](https://forum.biobakery.org/t/trying-to-understand-coef-column-and-how-to-convert-it-to-fold-change/3136/8 "2022-02-21T19:22:00Z")

</div>

Hello Himel.mallick.

I am so sorry, you got me a little even more confused.  
When you say “log2 transformation in place (default in MaAsLin 2”.  
it means, that, if I use Maaslin with default parameters (so that would be  
analysis\_method = “LM”)  
The “coef” column is already a log2fold change?  
I DO NOT need to do any further operation on the data.

not even the: x\<- log2(coef) step.

Is that correct?

I am sorry to be annoying. I just want to make sure I am reporting and explaining the value correctly.

Thanks!  
Gabri

---

<div class="post-metadata">

**Author:** ![himel.mallick](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.biobakery.org/himel.mallick/32/1757_2.png) [@himel.mallick](https://forum.biobakery.org/u/himel.mallick)\
**Post date:** [February 21, 2022, 9:20pm UTC](https://forum.biobakery.org/t/trying-to-understand-coef-column-and-how-to-convert-it-to-fold-change/3136/9 "2022-02-21T21:20:50Z")

</div>

Hi @mrgambero - that is correct. This is simply because the data is already log2-transformed and based on the math provided above, it will be approximately the same as the log2 fold-change value as shown below.

Actual log2(FC) = log2(mean(Group1/Group2))  
MaAsLin 2 coefficient or “Log2(FC)” for the default model = mean(log2(Group1)) - mean(log2(Group2)).

Does this make sense?

---

<div class="post-metadata">

**Author:** ![dts](https://avatars.discourse-cdn.com/v4/letter/d/8491ac/32.png) [@dts](https://forum.biobakery.org/u/dts)\
**Post date:** [February 22, 2022, 10:30am UTC](https://forum.biobakery.org/t/trying-to-understand-coef-column-and-how-to-convert-it-to-fold-change/3136/10 "2022-02-22T10:30:17Z")

</div>

It makes sense to me. Thanks again for your detailed explanations.

---

<div class="post-metadata">

**Author:** ![mrgambero](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.biobakery.org/mrgambero/32/1227_2.png) [@mrgambero](https://forum.biobakery.org/u/mrgambero)\
**Post date:** [February 22, 2022, 6:03pm UTC](https://forum.biobakery.org/t/trying-to-understand-coef-column-and-how-to-convert-it-to-fold-change/3136/11 "2022-02-22T18:03:07Z")

</div>

yes! thanks!  
Better to be sure I was not understanding pears for apples!

Thanks a lot!

---

<div class="post-metadata">

**Author:** ![dts](https://avatars.discourse-cdn.com/v4/letter/d/8491ac/32.png) [@dts](https://forum.biobakery.org/u/dts)\
**Post date:** [January 13, 2023, 1:05pm UTC](https://forum.biobakery.org/t/trying-to-understand-coef-column-and-how-to-convert-it-to-fold-change/3136/12 "2023-01-13T13:05:19Z")

</div>

Hi again.

I’m still a little bit confused about this. I just performed a 16S analysis and a differential abundance analysis of taxa with these parameters:

min\_abundance = 0.0,  
min\_prevalence = 0.0,  
normalization = “TSS”,  
transform = “LOG”,  
analysis\_method = “LM”,  
max\_significance = 0.05,  
correction = “BH”,  
standardize = FALSE

One taxon which is clearly more abundant in one type of sample (94%, 64% and 98% one type; 0.6%, 0.08% and 3.4% the other type). The results are:

|coef|0.599906572791737|  
|stderr|0.05919489753717|  
|pval|0.000533675113693|  
|qval|0.029992541389525|

As said in this thread, the coef value would correspond to log2 fold change, but I honestly believe it does not (with any other tool the log 2 fold change is between 6 and 7).

So my question is straightforward, how do you go from the coef value to the log2 fold change?

Thanks!

---

<div class="post-metadata">

**Author:** ![dts](https://avatars.discourse-cdn.com/v4/letter/d/8491ac/32.png) [@dts](https://forum.biobakery.org/u/dts)\
**Post date:** [March 16, 2023, 2:48pm UTC](https://forum.biobakery.org/t/trying-to-understand-coef-column-and-how-to-convert-it-to-fold-change/3136/13 "2023-03-16T14:48:07Z")

</div>

Any help? @himel.mallick I would really appreciate your help with this when you have a moment. Thank you!

---

<div class="post-metadata">

**Author:** ![himel.mallick](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.biobakery.org/himel.mallick/32/1757_2.png) [@himel.mallick](https://forum.biobakery.org/u/himel.mallick)\
**Post date:** [March 17, 2023, 12:44am UTC](https://forum.biobakery.org/t/trying-to-understand-coef-column-and-how-to-convert-it-to-fold-change/3136/14 "2023-03-17T00:44:47Z")

</div>

Hi @dts - can you clarify what you mean by `'with any other tool the log 2 fold change is between 6 and 7'`? The only comparable tools in my mind would be those based on linear models such as limma. Did you have a chance to take a look at the corresponding plot? Does the plot signify a huge effect size?

Thanks,  
Himel

---

<div class="post-metadata">

**Author:** ![sdabdoub](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.biobakery.org/sdabdoub/32/2525_2.png) [@sdabdoub](https://forum.biobakery.org/u/sdabdoub)\
**Post date:** [November 5, 2023, 8:42pm UTC](https://forum.biobakery.org/t/trying-to-understand-coef-column-and-how-to-convert-it-to-fold-change/3136/15 "2023-11-05T20:42:45Z")

</div>

Just to be even more explicit. If you have `transform = "NONE"` in the call to Maaslin2, then the following code will get you a significance-filtered results table with a log2fc column (using dplyr):

```auto
sig_res_fit <- fit_data$results %>% 
  mutate(log2fc = log2(exp(coef)), .before = pval) %>% 
  filter(qval <= 0.25) # default max_significance

```

---

<div class="post-metadata">

**Author:** ![Ray4](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.biobakery.org/ray4/32/3295_2.png) [@Ray4](https://forum.biobakery.org/u/Ray4)\
**Post date:** [June 18, 2025, 1:58am UTC](https://forum.biobakery.org/t/trying-to-understand-coef-column-and-how-to-convert-it-to-fold-change/3136/16 "2025-06-18T01:58:54Z")

</div>

Hi, all. I 'm suffering in this question!  
When i use **CPLM** model：

```auto
fitdata = Maaslin2(
  input_data = otu_df, #Relative abundance
  input_metadata = metadata,
  output = "maaslin2_results_test",
  fixed_effects = c("Group", "SEX", "AGE"),
  reference = c("Group,HC"),
  min_abundance = 0.0005,    
  min_prevalence = 0.1,      
  normalization = "TSS", 
  transform = "NONE",  
  analysis_method = "CPLM", 
  cores = 10
)

# the range :
> range(signif$coef)
[1] -3.344939 3.409124

```

When i use **LM** model :

```auto
fitdata = Maaslin2(
  input_data = otu_df, #RA
  input_metadata = metadata,
  output = "maaslin2_results",
  fixed_effects = c("Group", "SEX", "AGE"), 
  reference = c("Group,HC"),
  min_abundance = 0.0005,      
  min_prevalence = 0.1,      
  normalization = "NONE", 
  transform = "AST", 
  analysis_method = "LM",
  cores = 10
)

# the range:
> range(signif$coef)
[1] -0.08598747 0.01799624

```

The coef value is changed by different model!

So i wanna make sure which model could be chosen when i wanna use **logfc**?

It’s same like must use **CPLM** when i wanna use **logfc**?

---

<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:** [June 18, 2025, 9:32pm UTC](https://forum.biobakery.org/t/trying-to-understand-coef-column-and-how-to-convert-it-to-fold-change/3136/17 "2025-06-18T21:32:48Z")

</div>

Hi @Ray4,

The coefficients are going to be linked to the model you choose to do the analysis. However, more then that they are going to be linked to the scale of the input data the model is working with. In this case in the LM your using no normalization and AST transformation so the coefficients will be the difference in means on that scale. Similarly the CPLM model you are running will be on the scale of TSS normalized data.

In order to get log fold change you would want to run a model with a log transformation.

Thanks,  
Jacob Nearing

---

<div class="post-metadata">

**Author:** ![Ray4](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.biobakery.org/ray4/32/3295_2.png) [@Ray4](https://forum.biobakery.org/u/Ray4)\
**Post date:** [June 19, 2025, 2:05am UTC](https://forum.biobakery.org/t/trying-to-understand-coef-column-and-how-to-convert-it-to-fold-change/3136/18 "2025-06-19T02:05:03Z")

</div>

Got it ,thanks a lot! And have a good day!
