Combining groups in a LIMMA design
1
0
Entering edit mode
Ahdee ▴ 50
@ahdee-8938
Last seen 18 months ago
United States

Hi all I have a design that I'm wondering if someone can help me double check.  Basically I have he following groups. 

Adult.autism 
Peds.autism
Adult.control
Peds.control 

I want to do the following comparisons

* compare ped control vs. ped autism 
* compare adult control vs adult autism
* ped autism vs adult autism 
* ALL control vs ALL autism regardless of age.

Here are my codes and design.  Can someone help confirm if this is correct?  especially the last all group. thanks.  

 

group <- factor (key)
design <- model.matrix(~0+group )
colnames(design) = gsub ( "group","", colnames(design))
fmain  <- lmFit(voom.data, design )

contrast.matrix <- makeContrasts(p = ped.control - ped.autism, 

                                 a = adult.control - adult.autism,

                                 pVSa = ped.autism - adult.autism,

                                 ALL = (adult.autism + ped.autism) - (adult.control + ped.control ), 

                                   levels=design

                                   )

  

fmain.r <- contrasts.fit(fmain, contrast.matrix)

fmain.r <- eBayes(fmain.r)

result.p <- topTable(fmain.r, coef="p", n=Inf )
result.a <- topTable(fmain.r, coef="a", n=Inf )
result.pVSa <- topTable(fmain.r, coef="pVSa", n=Inf )
result.ALL <- topTable(fmain.r, coef="ALL", n=Inf ) 

limma • 851 views
ADD COMMENT
3
Entering edit mode
Aaron Lun ★ 28k
@alun
Last seen 17 hours ago
The city by the bay

I don't know what lmfmain or contrasts.fmain are. Aside from that, your design matrix looks fine. For your ALL contrast, you should divide by two as you're taking the average of the with/without autism groups:

ALL = (adult.autism + ped.autism)/2 - (adult.control + ped.control )/2

Otherwise your log-fold changes will be twice as large as they should be.

ADD COMMENT
0
Entering edit mode

Great thank you for helping confirm this.  and yes I can now see that dividing by 2 is necessary. There is a strange issue however that, only on certain datasets,  for some weird reason, running all the groups together and than building the contrast, for example, in the  a = adult.control - adult.autism, when I do this separately or together as the above example  the logFC calculation is different!? perhaps I should start a new thread.  Thing is I need to create a test set that can recapitulate this because on some dataset this does not happen. Weird.

ADD REPLY

Login before adding your answer.

Traffic: 633 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6