[BioC] Fitting linear model with different design matrix for each gene in limma

Elif Sarinay [guest] guest at bioconductor.org
Wed Dec 18 20:55:57 CET 2013


I have expression data from a large number of subjects with replicates. I am interested in fitting a linear model to understand the effect of a simple factor with two levels on the expression of each gene. I realize that if my design is as follows: 
Subject Factor
1       REF
1       REF
2       REF
2       REF
3       REF
3       REF
4       PLUS
4       PLUS
5       PLUS
5       PLUS

I can fit a linear model with lmFit using 
design <- model.matrix(~targets$Factor)
corfit <- duplicateCorrelation(data,design,block=targets$Subject)
lmFit (data, design, weights=weights, block=targets$Subject, correlation=corfit$consensus)

However, in my case the design is different for each gene. In other words, the subjects that belong to the "REF" or "PLUS" level of the factor changes for each gene. I am wondering if there is any possibility to include the changing design for each gene. 

I tried applying lmFit to each gene separately using the correct design with an appropriate apply function. However, I found Dr. Smyth's answer to an earlier question (https://stat.ethz.ch/pipermail/bioconductor/2010-August/034794.html) suggesting that this is not a good alternative. 

Thanks for any advice

 -- output of sessionInfo(): 

R version 2.14.1 (2011-12-22)
Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit)

[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] nlme_3.1-103 edgeR_2.4.6  limma_3.10.3

loaded via a namespace (and not attached):
[1] grid_2.14.1    lattice_0.20-6 sva_3.0.3      tools_2.14.1  

Sent via the guest posting facility at bioconductor.org.

More information about the Bioconductor mailing list