[BioC] two way ANOVA with limma

Grant R Cramer cramer at unr.edu
Sat Oct 15 01:15:41 CEST 2011


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/



More information about the Bioconductor mailing list