[BioC] design matrix

James W. MacDonald jmacdon at med.umich.edu
Wed Oct 3 17:52:35 CEST 2007


Lev Soinov wrote:
> Dear List,
>    
>   I have got a very simple, I suppose, question.
>   Is there any difference between the following two designs if I just want to make pairwise comparisons between three groups as in the LIMMA user guide, p.31, Affymetrix and Other Single-Channel Designs.
>   1.
>   > data <- ReadAffy()
>   > eset <- rma(data)
>   > design <- model.matrix(~ -1+factor(c(1,1,1,2,2,3,3,3)))
>   > colnames(design) <- c("group1", "group2", "group3")
>   > fit <- lmFit(eset, design)
>   > contrast.matrix <- makeContrasts(group2-group1, group3-group2, group3-group1, levels=design)
>   > fit2 <- contrasts.fit(fit, contrast.matrix)
>   > fit2 <- eBayes(fit2)
>    
>   2. 
>   > data <- ReadAffy()
>   > eset <- rma(data)
>   > design <- model.matrix(~ 0+factor(c(1,1,1,2,2,3,3,3)))
>   > colnames(design) <- c("group1", "group2", "group3")
>   > fit <- lmFit(eset, design)
>   > contrast.matrix <- makeContrasts(group2-group1, group3-group2, group3-group1, levels=design)
>   > fit2 <- contrasts.fit(fit, contrast.matrix)
>   > fit2 <- eBayes(fit2)
>    
>   The only difference between the above two codes is in use of the design <- model.matrix(~ 0+factor(c(1,1,1,2,2,3,3,3))) or design <- model.matrix(~ -1+factor(c(1,1,1,2,2,3,3,3))). They produce identical design matrices and, as far as I can see, identical results in fit2. So, can we use "0" and "-1" here interchangeably?
>    

Since they produce identical design matrices it would appear they are 
identical, no? Anyway, the help page you are looking for is ?formula. 
 From the 'Details' section:

It can also used to
      remove the intercept term: 'y ~ x - 1' is a line through the
      origin.  A model with no intercept can be also specified as 'y ~ x
      + 0' or 'y ~ 0 + x'.

Best,

Jim

>   With kind regards,
>   Lev.
> 
>        
> ---------------------------------
> 
> 	[[alternative HTML version deleted]]
> 
> _______________________________________________
> Bioconductor mailing list
> Bioconductor at stat.math.ethz.ch
> 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
Affymetrix and cDNA Microarray Core
University of Michigan Cancer Center
1500 E. Medical Center Drive
7410 CCGC
Ann Arbor MI 48109
734-647-5623



More information about the Bioconductor mailing list