[BioC] limma

James W. MacDonald jmacdon at med.umich.edu
Wed Jul 22 20:31:18 CEST 2009


Hi Claire,

Claire Vandiedonck wrote:
> Hi everyone,
> 
> I am not a statistician, so please forgive me if my question is trivial. 
> I have some difficulties with the factorial design in limma with 2 
> factors with 2 and 3 levels respectively.
> 
> Say the two factors are "Treatment" and "Source", with respectively two 
> and three levels:
>  >Treatment
> [1] No  No  No  Yes Yes Yes No  No  No  Yes Yes Yes No  No  No  Yes Yes Yes
> Levels: No Yes
>  > Source
> [1] RNA1 RNA1 RNA1 RNA1 RNA1 RNA1 RNA2 RNA2 RNA2 RNA2 RNA2 RNA2 RNA3 
> RNA3 RNA3 RNA3 RNA3 RNA3
> Levels: RNA1 RNA2 RNA3
> 
> I have three replicates of each condition per source, hence 18 arrays 
> (which are Affymetrix).
> My target is as follow:
>   Source Treatment
> 1    RNA1        No
> 2    RNA1        No
> 3    RNA1        No
> 4    RNA1       Yes
> 5    RNA1       Yes
> 6    RNA1       Yes
> 7    RNA2        No
> 8    RNA2        No
> 9    RNA2        No
> 10   RNA2       Yes
> 11   RNA2       Yes
> 12   RNA2       Yes
> 13   RNA3        No
> 14   RNA3        No
> 15   RNA3        No
> 16   RNA3       Yes
> 17   RNA3       Yes
> 18   RNA3       Yes
> 
> I create the following design matrix:
> design <- model.matrix(~0+Treatment*Source)
> 
> and apply the linear model:
> fit <- lmFit(data, designl)
> 
> But then I fail in making the contrasts. I only manage to get pairwise 
> effects, while I would like the following three effects: main effect of 
> the treatment, main effect of the source, interaction between effect and 
> source. Could any one help me please?

You only need one contrast. The first and second coefficients of your 
design matrix are for the main effect of treatment, so you need a 
contrast matrix of

matrix(c(-1,1,0,0,0,0), ncol = 1)

to get that contrast.

The third and fourth coefficients capture the differences between RNA2 
and RNA1, and RNA3 and RNA1 respectively, so that is your main effect 
for source. If by main effect you want the F-statistic for the overall 
test of any difference between the sources, then you can get that using 
topTable() and subsetting your MArrayLM object. Say you do this:

fit2 <- eBayes(fit)

then

topTable(fit2[,3:4])

will give you the F-stats for that main effect.

The fifth and sixth coefficients give you the interaction terms (there 
are two since you have three levels of RNA source). The fifth 
coefficient gives the interaction between RNA1 and RNA2 over the two 
treatments and the sixth coefficient gives the interaction between RNA1 
and RNA3 over the two treatments. Again, you can get the F-statistic for 
any interaction using topTable and subsetting your MArrayLM object 
accordingly.

Best,

Jim


> 
> Alternatively, I used the group parametrization approach with one factor 
> with 6 levels corresponding to my 6 combinations. This way, I managed to 
> extract each of my contrasts of interest, but I would really like to 
> understand how to use limma in a more classical statistical way, like in 
> a two-way anova. Any help would be very much appreciated as my data are 
> susceptible to get more complicated with additional treatments and even 
> paired samples. Many thanks in advance.
> 
> BW
> 
> Claire
> 
> 

-- 
James W. MacDonald, M.S.
Biostatistician
Douglas Lab
University of Michigan
Department of Human Genetics
5912 Buhl
1241 E. Catherine St.
Ann Arbor MI 48109-5618
734-615-7826



More information about the Bioconductor mailing list