Answers.Body: <p>Yes, you can use the second one for volcano plots, but it might help to understand what it's implying.</p>
  <p>The difference between these formulas is in the <code>mean</code> calculation. The following equations are identical:</p>
  <pre><code>log(a/b)
  </code></pre>
  <p>and</p>
  <pre><code>log(a) - log(b)
  </code></pre>
  <p>However, in your example, the first equation calculates the mean prior to doing the log, whereas the second example does the log first (i.e. <code>log(mean(Group1))</code> vs <code>mean(log(Group1))</code>).</p>
  <p>As a consequence, the equations are <em>similar</em>, but not identical, and that difference depends on the underlying assumptions of the expression model.</p>
  <p>In the first equation (what you call 'Actual'), the genes are assumed to follow a normal distribution in linear space, whereas in the second equation they're assumed to follow a normal distribution in <em>log</em> space.</p>
  <p>Which one of these is correct is a subject of debate. It's pretty much established that gene expression for <em>all genes together</em> is log-normal (or, at least, much closer to log-normal than to linear), but whether this applies at an individual gene level is less clear.</p>
  <p>In most cases, the results will be similar when looking at individual genes, and the equations can be used interchangeably. Where they differ substantially, there will be large expression differences between genes, so it's unlikely to alter the interpretation of results.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-06-07T02:06:03.973Z
Answers.LastActivityDate: 2021-06-07T02:06:03.973Z
Answers.UserDisplayName: gringer
Answers.Body: <p>You can use what limma reports for everything, including volcano plots. In the post you link to I describe in a comment why this is done in every package that I know.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-08-20T21:38:11.743Z
Answers.LastActivityDate: 2020-08-20T21:38:11.743Z
Answers.UserDisplayName: Devon Ryan
Body: <p>It seems that we have two calculations of log fold change:</p>
  <p><code>Actual log2(FC) = log2(mean(Group1)/mean(Group2))</code></p>
  <p><code>Limma's &quot;Log(FC)&quot; = mean(log2(Group1)) - mean(log2(Group2))</code></p>
  <p>For volcano plots, can we use the second one?</p>
  <p><a href="https://www.biostars.org/p/100460/" rel="nofollow noreferrer">https://www.biostars.org/p/100460/</a></p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-08-19T05:50:46.170Z
Comments.Text: Aren't the outputs of both calculations the same?
Comments.UserDisplayName: Reza Rezaei
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-08-19T17:07:56.683Z
Comments.Text: `log(x/y) = log(x) - log(y)` -> this is log math. Like @RezaRezaei says, the two calculations are the same. I guess there could be differences owing to how computers calculate the values.
Comments.UserDisplayName: Ram RS
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-08-20T12:28:14.460Z
Comments.Text: @RamRS Could there be a small difference due to finite precision of log transformation?
Comments.UserDisplayName: Kamil S Jaron
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-08-20T17:42:01.780Z
Comments.Text: @KamilSJaron I guess it could be a factor. I don't know how computers do complex math, but I'm guessing that's where the difference lies. I think for x=20, y = 5, the two log2 values should be the same. I do think that even for more complex math, precision should be maintained to the third decimal place at least, so how significant would the difference be?
Comments.UserDisplayName: Ram RS
Tags: <r>
Title: About the log2 fold change
ThreadText: # About the log2 fold change
  
  (Asked by: username_0 on 2020-08-19)
  
  It seems that we have two calculations of log fold change:
  
  `Actual log2(FC) = log2(mean(Group1)/mean(Group2))`
  
  `Limma's "Log(FC)" = mean(log2(Group1)) - mean(log2(Group2))`
  
  For volcano plots, can we use the second one?
  
  <https://www.biostars.org/p/100460/>
  
  **Tags:** r
  
  > **Comments:**
  > **username_1**: Aren't the outputs of both calculations the same?  
  > **username_2**: `log(x/y) = log(x) - log(y)` -> this is log math. Like @username_1 says, the two calculations are the same. I guess there could be differences owing to how computers calculate the values.  
  > **username_3**: @username_2 Could there be a small difference due to finite precision of log transformation?  
  > **username_2**: @username_3 I guess it could be a factor. I don't know how computers do complex math, but I'm guessing that's where the difference lies. I think for x=20, y = 5, the two log2 values should be the same. I do think that even for more complex math, precision should be maintained to the third decimal place at least, so how significant would the difference be?  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_4 on 2021-06-07. Score: 1
  
  Yes, you can use the second one for volcano plots, but it might help to understand what it's implying.
  
  The difference between these formulas is in the `mean` calculation. The following equations are identical:
  
  ```
  log(a/b)
  
  ```
  
  and
  
  ```
  log(a) - log(b)
  
  ```
  
  However, in your example, the first equation calculates the mean prior to doing the log, whereas the second example does the log first (i.e. `log(mean(Group1))` vs `mean(log(Group1))`).
  
  As a consequence, the equations are *similar*, but not identical, and that difference depends on the underlying assumptions of the expression model.
  
  In the first equation (what you call 'Actual'), the genes are assumed to follow a normal distribution in linear space, whereas in the second equation they're assumed to follow a normal distribution in *log* space.
  
  Which one of these is correct is a subject of debate. It's pretty much established that gene expression for *all genes together* is log-normal (or, at least, much closer to log-normal than to linear), but whether this applies at an individual gene level is less clear.
  
  In most cases, the results will be similar when looking at individual genes, and the equations can be used interchangeably. Where they differ substantially, there will be large expression differences between genes, so it's unlikely to alter the interpretation of results.
  
  
  ---
  
  ### Answer by username_5 on 2020-08-20. Score: 0
  
  You can use what limma reports for everything, including volcano plots. In the post you link to I describe in a comment why this is done in every package that I know.
  
  
  ---
  
  