Using Nested Interaction Formula in limma
1
0
Entering edit mode
bnm3we • 0
@bnm3we-9063
Last seen 8.5 years ago
United States

In limma user guide 9.5.3 A Nested Interaction Formula (Page 44), the example has two levels for stimulation factor: S and U. Can I also use this model design for factor of more than two levels? To be specific, the example target frame is this:

FileName Strain Treatment

File1 WT U

File2 WT S

File3 Mu U

File4 Mu S

File5 Mu S

According to the user guide, if we just want to compare S vs. U for WT and Mu respectively, the design matrix can be setup using:  

> Strain <- factor(targets$Strain, levels=c("WT","Mu"))

> Treatment <- factor(targets$Treatment, levels=c("U","S"))

> design <- model.matrix(~Strain+Strain:Treatment)

> colnames(design)

[1] "(Intercept)" "StrainMu" "StrainWT:TreatmentS" "StrainMu:TreatmentS" 

The last two columns represent the effects of stimulation on WT and MU respectively. And this is exactly the same as doing following: combine two factors into one :TS (levels:WT.S, WT.U, Mu.S, Mu.U) and setup design matrix using model.matrix( ~0+TS) THEN makeContrasts( SvsUinWT=WT.S-WT.U,  SvsUinMu=Mu.S-Mu.U, levels=design)

Above is from the user guide. NOW, back to my question.  I have a target frame like this:

File    Day    Drug
file1    1    Ctrl
file2    1    Ctrl
file3    1    Ctrl
file4    1    Drug1
file5    1    Drug1
file6    1    Drug1
file7    1    Drug2
file8    1    Drug2
file9    1    Drug2
file10    1    Drug3
file11    1    Drug3
file12    1    Drug3
file13    2    Ctrl
file14    2    Ctrl
file15    2    Ctrl
file16    2    Drug1
file17    2    Drug1
file18    2    Drug1
file19    2    Drug2
file20    2    Drug2
file21    2    Drug2
file22    2    Drug3
file23    2    Drug3
file24    2    Drug3
file25    4    Ctrl
file26    4    Ctrl
file27    4    Ctrl
file28    4    Drug1
file29    4    Drug1
file30    4    Drug1
file31    4    Drug2
file32    4    Drug2
file33    4    Drug2
file34    4    Drug3
file35    4    Drug3
file36    4    Drug3

To summarize, I have 4 levels for the factor of Drug (including the Ctrl) and 3 levels for the factor Day. For each of the combination of Drug and Day I have 3 samples. All 36 samples are from 36 different subjects so this is NOT a time-course study on same set of subjects. 

My question is: if I only want to compare Drug1 vs. Ctl, Drug2 vs.Ctl, Drug3 vs.Ctl at each of the Day point(1, 2, 4), can I use the nested interaction formula like this:

day <- factor(targets$Day)
drug <- factor(targets$Drug)
drug <- relevel(drug, "Ctrl")

design <- model.matrix(~day+day:drug)
fit <- lmFit(dta, design)
fit <- eBayes(fit)

The design matrix look like this:

[1] "(Intercept)"    "day2"           "day4"           "day1:drugDrug1"
 [5] "day2:drugDrug1" "day4:drugDrug1" "day1:drugDrug2" "day2:drugDrug2"
 [9] "day4:drugDrug2" "day1:drugDrug3" "day2:drugDrug3" "day4:drugDrug3"

a. Are the results from column 4("day1:drugDrug1") to 12  what I need? 

b. And is this the same as doing following: combine Day and Drug to one factor DayDrug(levels: Day1.Ctl, Day1.Drug1,...) and using

design <- model.matrix(~0+DayDrug)

fit <- lmFit(dta, design)

cont.matrix <- makeContrasts(Day1Drug1vsCtl =Day1.Drug1 - Day1.Ctl, Day2Drug1vsCtl =Day2.Drug1 - Day2.Ctl, ..., levels=design)

I appreciate any opinion from anybody. I've consulted several people around and got conflicted answers. Please help.

Cindy Wang

 

 

limma microarray • 1.4k views
ADD COMMENT
0
Entering edit mode
Aaron Lun ★ 28k
@alun
Last seen 12 hours ago
The city by the bay

For your first question, yes; each of coefficients 4 to 12 represents the effect of the one of the drugs over control on one of the days. Dropping each coefficient individually with the coef= argument in topTable will test for DE between the corresponding drug and control on the corresponding day.

For your second question, yes; the design matrices are effectively equivalent, as you can perform linear column operations to get from one to the other. If design is your first matrix, you can get to the second one by running:

design2 <- design
design2[,1] <- design[,1] - rowSums(design[,c(2,3,4,7,10)])
design2[,2] <- design[,2] - rowSums(design[,c(5,8,11)])
design2[,3] <- design[,3] - rowSums(design[,c(6,9,12)])

The contrasts you've made will also test for DE between the requested drug and control at each specified day, as intended.

ADD COMMENT
0
Entering edit mode

Aaron, thank you very much for confirmation and clarification.

 

 

ADD REPLY

Login before adding your answer.

Traffic: 1001 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