# [BioC] Limma User's Guide Example of design matrices

Thu Apr 27 09:30:19 CEST 2006

```Dear Mike,

I will leave the explanations to the experts, but as a beginner I
found two books very useful in understanding linear models and
contrasts:

Introductory Statistics with R, by Peter Dalgaard

and

Design and Analysis of experiments, by Douglas C Montgomery

HTH,

David

> I am working my way through the Limma User's Guide and had a
question
> about the design matrices for the example in section 8.4 (2 groups,
> same reference).
> I understand the difference between the two design matrices in
terms
> of what you can extract directly from the linear model and what has
> to be obtained by contrasts and how you directly construct the
> matrices using cbind as in the manual. I have two questions, one of
> which may trivial (i.e., stupid), and the other not. I will preface
> this by admitting that my knowledge of statistics beyond the very
> basics is relatively weak.
>
> The non-trivial question:
>
> I realize that more than one design matrix can be set up to analyze
> the same set of data (as in the example), and that similar results
> should be obtainable with each design. If you are eventually
> obtaining the same information from each design (i.e., identifying
> differentially expressed genes) what is the benefit of one design
> over the other- could one design produce a different level of
> statistical confidence that a given set of genes is differentially
> regulated? Is there any rule of thumb for choosing one design
matrix
> over another?
>
> The trivial (?) question
>
> I set up the two types of design matrices using the factor Group
and
> the model.matrix function as in the manual:
>
>  > Group-> factor(c("WT","WT","MU","MU","MU"),levels=c("WT","MU"))
>  > Group
> [1] WT WT MU MU MU
> Levels: WT MU
>  > design-> model.matrix(~Group)
>  > design
>    (Intercept) GroupMU
> 1           1       0
> 2           1       0
> 3           1       1
> 4           1       1
> 5           1       1
> attr(,"assign")
> [1] 0 1
> attr(,"contrasts")
> attr(,"contrasts")\$Group
> [1] "contr.treatment"
>
>  > design2-> model.matrix(~0+Group)
>  > design2
>    GroupWT GroupMU
> 1       1       0
> 2       1       0
> 3       0       1
> 4       0       1
> 5       0       1
> attr(,"assign")
> [1] 1 1
> attr(,"contrasts")
> attr(,"contrasts")\$Group
> [1] "contr.treatment"
>
>
> I have not been able to find a clear explanation of what the tilde
> (~)  does in model.matrix to produce the design matrix, especially
in
> the context of "~0+Group." Any idea as to where  I can get an
> explanation of how this works? (The 2445-page R manual wasn't any
> help!).
>
> Thanks for you help!
>
> Mike White
>
>
>
> Michael M. White, Ph.D.
> Department of Pharmacology & Physiology
> MS #488
> Drexel University College of Medicine
> 245 N. 15th Street
>
>
>
>
>
> 	[[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
>

```