[BioC] logFC in GLM of egdeR

Gordon K Smyth smyth at wehi.EDU.AU
Thu Apr 4 02:41:30 CEST 2013


Dear Xinwei,

No, not quite.

It would be best to try to think in terms of linear comparisons on the 
log-scale, because that is how glms works.  A-B-C+D means

  (average log CPM in A)
  minus
  (average log CPM in B)
  minus
  (average log CPM in C)
  add
  (average log CPM in D)

You can think of it as twice

  (average log CPM in A and D)
  minus
  (average log CPM in B and C).

or you could think of it as

  (log fold change from A to B)
  plus
  (log fold change from D to C)

but none of these are quite the same as what you wrote.  Your expression 
interchanges averages and logs in a way that is not correct.

Note that the logFC you get from the contrast c(1,-1,-1,1) is exactly 
equal to the logFC you get from c(1,-1,0,0) plus what you get from 
(0,0,-1,1).  It just adds up in the natural way.

Best wishes
Gordon


On Tue, 2 Apr 2013, Xinwei Han wrote:

> HI Gordon,
>
> Thanks. Does that mean in the second case, basically logFC = log2 ( 
> (average CPM in D+ average CPM in A) / (average CPM in B +average CPM in 
> C) ), except for other adjustments from negative binomial?
>
> Thanks,
> Xinwei
>
>
> On Tue, Apr 2, 2013 at 7:03 PM, Gordon K Smyth <smyth at wehi.edu.au> wrote:
>
>> Dear Xinwei,
>>
>> Well, in the first case you get C-A (C minus A).  In the second case you
>> get A-B-C+D.
>>
>> Best wishes
>> Gordon
>>
>>  Date: Mon, 1 Apr 2013 23:10:42 -0400
>>> From: Xinwei Han <xinwei.han at duke.edu>
>>> To: <bioconductor at stat.math.ethz.**ch <bioconductor at stat.math.ethz.ch>>
>>> Subject: [BioC] logFC in GLM of egdeR
>>>
>>> Hi,
>>>
>>> I fit a GLM with edgeR like this:
>>>
>>>  colnames(fit)
>>>>
>>> A B C D
>>>
>>> For contrast = c(-1,0,1,0), I guess logFC = log2 (average CPM in C/
>>> average
>>> CPM in A).
>>>
>>> But for contrast = c(1,-1,-1,1), how is logFC calculated?
>>>
>>> Thanks,
>>> Xinwei
>>>
>>>
>> ______________________________**______________________________**__________
>> The information in this email is confidential and intended solely for the
>> addressee.
>> You must not disclose, forward, print or use it without the permission of
>> the sender.
>> ______________________________**______________________________**__________
>>
>

______________________________________________________________________
The information in this email is confidential and intend...{{dropped:4}}



More information about the Bioconductor mailing list