a question on creating model.matrix using limma
1
2
Entering edit mode
@srinivas-iyyer-939
Last seen 7.3 years ago
Dear Dr. Smith and group, apologies for simple question. I have data with simple plan. There are 8 samples (4 normal and 4 tumor). These tissue samples are from different patients. No replicate experiments were done. I wish to see genes differentially expressed between Tumors and normals. In such cases how can I create model.matrix Following is taken from Limma manual: design <- model.matrix(~ -1 + factor(c(1,1,1,2,2,3,3,3))) my question: 1. what is '~ -1' is for? 2. Will this work for my study structure. That means I have only two types of RNA 1. tumor and 2. Normal. design <- model.matrix(~ -1 + factor(c(1,1,1,1,2,2,2,2))). Thanks sri
limma limma • 4.8k views
0
Entering edit mode
@james-w-macdonald-5106
Last seen 1 day ago
United States
Hi Srinivas, Srinivas Iyyer wrote: > Dear Dr. Smith and group, > > apologies for simple question. > > I have data with simple plan. There are 8 samples (4 > normal and 4 tumor). These tissue samples are from > different patients. No replicate experiments were > done. > I wish to see genes differentially expressed between > Tumors and normals. > > In such cases how can I create model.matrix > > > Following is taken from Limma manual: > > design <- model.matrix(~ -1 + > factor(c(1,1,1,2,2,3,3,3))) > > > my question: > 1. what is '~ -1' is for? The default for model.matrix() is to fit a model that has an intercept (or in the case of ANOVA, a baseline level). If you specify the model with either ~ -1 or ~ 0, then you are saying that you don't want an intercept. > 2. Will this work for my study structure. That means > I have only two types of RNA 1. tumor and 2. Normal. > design <- model.matrix(~ -1 + > factor(c(1,1,1,1,2,2,2,2))). This will work, but you will also need to fit a contrast between tumor and normal, so you will need something like this: design <- model.matrix(~-1 + factor(rep(1:2, each=4))) colnames(design) <- c("tumor","normal") contrast <- makeContrasts(tumor - normal, levels = design) fit <- lmFit(eset, design) fit2 <- contrasts.fit(fit, contrast) fit2 <- eBayes(fit2) topTable(fit2) Alternatively, you can fit an intercept and then will not need to fit a contrast, because it will be implicit in the model. design <- model.matrix(~factor(rep(1:2, each=4))) fit <- lmFit(eset, design) fit2 <- eBayes(fit) topTable(fit2, coef = 2) HTH, Jim > > Thanks > sri > > _______________________________________________ > 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 ********************************************************** Electronic Mail is not secure, may not be read every day, and should not be used for urgent or sensitive issues.