[BioC] question about model.matrix and makeContrasts for limma

James W. MacDonald jmacdon at uw.edu
Wed Apr 10 15:47:32 CEST 2013


Hi Jainhong Ou,

On 4/10/2013 9:24 AM, Ou, Jianhong wrote:
> Hi All,
>
> I have samples like this:
> Targets.txt>>
> Filename group replicates
> V1            vec     rep1
> V2            vec     rep2
> V3            vec     rep3
> A1            aec     rep1
> A2            aec     rep2
> A2            aec     rep2
> C1             cec     rep1
> C2             cec     rep2
> C3             cec     rep3
> D1             dec     rep1
> D2             dec     rep2
> D3             dec     rep3
> E1             eec     rep1
> E2             eec     rep2
> E3             eec     rep3
>
> If I want to compare group vec to all the others, is this correct I create model matrix and make contrasts like this,
> design<- model.matrix(~-1+group)
> colnames(design)<- gsub("^group","",colnames(design))
> contrast.matrix<- makeContrasts(contrasts="vec-(aec+cec+dec+eec)/4", levels=design)

That would be the conventional way of doing it.

>
> Or should I do it like,
> block<- factor(c(rep("b1", 3), rep("b2",12)))
> design<- model.matrix(~-1+block+block:group)
> colnames(design)<- gsub("^block","",colnames(design))
> contrast.matrix<- makeContrasts(contrasts="b1-b2", levels=design)

That would not be a way to do it. Did you look at the design matrix you 
created? If so did you notice that you have four columns that contain 
only zeros? What did you hope to accomplish with the block:group 
specification?

You can always check for problems with the nonEstimable() function in limma:

 > nonEstimable(model.matrix(~0+block+block:group))
[1] "block1:group2" "block1:group3" "block1:group4" "block1:group5"
[5] "block2:group5"

Best,

Jim


>
> Thanks in advance for you help.
>
> Yours sincerely,
>
> Jianhong Ou
>
> LRB 710
> Program in Gene Function and Expression
> 364 Plantation Street Worcester,
> MA 01605
>
> 	[[alternative HTML version deleted]]
>
> _______________________________________________
> Bioconductor mailing list
> Bioconductor at r-project.org
> https://stat.ethz.ch/mailman/listinfo/bioconductor
> Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor

-- 
James W. MacDonald, M.S.
Biostatistician
University of Washington
Environmental and Occupational Health Sciences
4225 Roosevelt Way NE, # 100
Seattle WA 98105-6099



More information about the Bioconductor mailing list