[BioC] limma design matrix

MacDonald, James jmacdon at med.umich.edu
Tue Jan 3 16:08:47 CET 2012


Hi Assa,

On 1/3/12 7:32 AM, Assa Yeroslaviz wrote:
> Hi bioC User,
>
> I have a set of 18 Affymetrix arrays with three different conditions. The
> annotation looks like that:
> number    condition    group
> 19    wt    total
> 20    wt    total
> 21    wt    total
> 22    LiCl    total
> 23    LiCl    total
> 24    LiCl    total
> 25    wt    low
> 26    wt    low
> 27    wt    low
> 28    LiCl    low
> 29    LiCl    low
> 30    LiCl    low
> 31    wt    high
> 32    wt    high
> 33    wt    high
> 34    LiCl    high
> 35    LiCl    high
> 36    LiCl    high
>
> for each of the groups total, low and high I would like to compare wt vs.
> LiCl (treatment).
> I was trying to create a design matrix for the complete data set, but
> somehow I am mixing everything up.
>
> Can someone please help me with the with the correct construction of the
> design matrix.
>

The easiest way is to use the model.matrix() function.

What I would normally do is this:

condition <- factor(rep(1:2, each = 3, times = 3))
group <- factor(rep(1:3, each = 6))

design <- model.matrix(~ 0 + condition + group)

Because that will allow more comparisons than what you want. However, it 
is easy enough to get what you want:


design <- model.matrix(~0 + factor(rep(1:6, each = 3)))

colnames(design) <- paste(rep(c("wt","LiCl"), 3), 
rep(c("total","low","high"), each = 2), sep = ".")

You will note that the design matrix you get is not the same as what you 
have below, because you cannot have a column of zeros.

Best,

Jim



> If I understand it correctly it should looks like this:
> 1    0    0    0    0    0    0
> 1    0    0    0    0    0    0
> 1    0    0    0    0    0    0
> 0    1    0    0    0    0    0
> 0    1    0    0    0    0    0
> 0    1    0    0    0    0    0
> 0    0    1    0    0    0    0
> 0    0    1    0    0    0    0
> 0    0    1    0    0    0    0
> 0    0    0    1    0    0    0
> 0    0    0    1    0    0    0
> 0    0    0    1    0    0    0
> 0    0    0    0    1    0    0
> 0    0    0    0    1    0    0
> 0    0    0    0    1    0    0
> 0    0    0    0    0    1    0
> 0    0    0    0    0    1    0
> 0    0    0    0    0    1    0
>
> But somehow I can neither create it nor write the right header.
> I would appreciate your help
>
> Thanks
> Assa
>
> 	[[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
Douglas Lab
University of Michigan
Department of Human Genetics
5912 Buhl
1241 E. Catherine St.
Ann Arbor MI 48109-5618
734-615-7826

**********************************************************
Electronic Mail is not secure, may not be read every day, and should not be used for urgent or sensitive issues 



More information about the Bioconductor mailing list