[BioC] two way ANOVA with limma

Gordon K Smyth smyth at wehi.EDU.AU
Mon Oct 17 00:03:20 CEST 2011


Dear Professor Cramer,

Why not

   design <- model.matrix(~Organ*Treatment,data=pData(eset))

?

If that doesn't work, then you need to show us what pData(eset) contains. 
Also, the choice of design matrix does depend on what hypotheses you want 
to test, and you haven't said anything about that.

Best wishes
Gordon

> Date: Fri, 14 Oct 2011 16:15:41 -0700
> From: Grant R Cramer <cramer at unr.edu>
> To: "bioconductor at stat.math.ethz.ch" <bioconductor at stat.math.ethz.ch>
> Subject: [BioC] two way ANOVA with limma
> Message-ID: <FB9AC11A-598D-469E-8B75-2D0121C6257A at unr.edu>
> Content-Type: text/plain; charset="us-ascii"
>
> Hi,

> I have a question regarding setting up a two way anova with two factors: 
> organ (5 levels) and treatment (2 levels). I am not sure quite how to 
> set this up. I understand from the user guide in limma how to set up a 2 
> x 2. And I understand how to set up the interaction term by subtracting 
> the differences, but having 5 levels has stumped me. Can you explain a 
> way to set it up?

> I am using a Nimblegen array with approximatel 20,000 probes and I have 
> 30 arrays in my columns for my eset (3 replicates of each treatment and 
> organ).
>
> Here is what I was using in my script:
>
> trts = c("B.A","B.C","C.A","C.C","L.A","L.C","R.A","R.C","S.A","S.C")
>> f = gl(10,3,labels=trts)
>> design <- model.matrix(~0+f)
>> colnames(design) <- trts
>> fit <- lmFit(eset, design)
>> contrasts <- makeContrasts(OxT =(B.A-B.C)-(C.A-C.C)-(L.A-L.C)-(R.A-R.C)-(S.A-S.C),O = (B.A+B.C)-(C.A+C.C)-(L.A+L.C)-(R.A+R.C)-(S.A-S.C),T = (B.A+C.A+L.A+R.A+S.A)-(B.C+C.C+L.C+R.C+S.C),levels=design)
>> fit2 <- contrasts.fit(fit, contrasts)
>> 	fit2 <- eBayes(fit2)
>
> I don't think I did this correctly. Any suggestions?
>
> I also tried defining the  factors with different levels, but I got an error:
>
>
>> levels(f) <- list(B=c(1:6), Cu=c(7:12), L=c(13:18), R=c(19:24), S=c(25:30))
>> Organ <- factor(eset$Organ, levels=c("B","Cu","L","R","S"))
>> levels(f) <- list(A=c(1:3,7:9,13:15,19:21,25:27), C=c(4:6,10:12,16:18,22:24,28:30))
>> Treatment <- factor(eset$Treatment, levels=c("A","C"))
>> contrasts(Organ) <- contr.sum(5)
>> contrasts(Treatment) <- contr.sum(2)
>> design <- model.matrix(~Organ*Treatment)
>
> Warning message:
> In is.na(rows) : is.na() applied to non-(list or vector) of type 'NULL'
>
> Thanks for your help in advance!
>
> Grant R. Cramer
> Professor
> Department of Biochemistry and Molecular Biology, MS 330
> University of Nevada, Reno
> Reno, NV 89557
> (775) 784-4204
> cramer at unr.edu
> http://www.ag.unr.edu/cramer/

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



More information about the Bioconductor mailing list