On 08/04/2011 08:53 AM, Belmont, John W wrote:
I am trying to correct for the effect of 2 covariates in a gene
expression data set.

design<-model.matrix(~0 + Factor + cov1 + cov2)


QUESTION: How to set up the contrast matrix?

The usual commands

fit <- lmFit(selDataMatrix, design)
cont.matrix <- makeContrasts(FacCont=Group1-Group2, levels=design)
fit2 <- contrasts.fit(fit, cont.matrix)

does not work because the original design matrix includes the
covariates.

I think I don't really understand how the contrast matrix works.

1) Unless you are sure you know what you're doing and have given this a lot of thought, I doubt you want to remove the intercept in this model.

2) A contrast specifies the coefficients of the linear combination of parameters that you wish to estimate/test. If you don't know what this means, then I would advise learning more about regression or consulting a statistician before proceeding.

3) If the first two comments haven't scared you off, then you can specify contrasts via:

cont.matrix <- matrix(c(-1,1,0,0),ncol=1)

under the original parameterization, or

cont.matrix <- matrix(c(0,1,0,0),ncol=1)

if you take the advice of point 1) and put an intercept in your model.

--
Patrick Breheny
Assistant Professor
Department of Biostatistics
Department of Statistics
University of Kentucky

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to