Should the design matrix for removeBatchEffect include an intercept?
1
0
Entering edit mode
Sam ▴ 10
@sam-21502
Last seen 1 day ago
Jerusalem

Hello,

I am removing a batch effect from my data using limma's removeBatchEffect. The variable of interest should not be removed, hence I include it in the design matrix. Should the design matrix include an intercept term? Does it matter?

removeBatchEffect limma • 144 views
ADD COMMENT
0
Entering edit mode
@gordon-smyth
Last seen 13 minutes ago
WEHI, Melbourne, Australia

The design matrix is just the usual design matrix that you would naturally use in an analysis without the batch effect, regardless of whether you like to use ~0 in your model formula or not.

The design matrix does has the span the intercept term, but it can do so implicitly rather than explicitly. Suppose that Condition is a factor of interest and you are planning ot use

y2 <- removeBatchEffect(y,batch=Batch,design=design)

You could use

design <- model.matrix(~Condition)

or

design <- model.matrix(~0+Condition)

and both of these are exactly the same from a mathematical point of view and will produce the same result.

However you could not remove the intercept by

design <- model.matrix(~Condition)
design <- design[,-1]

because then the design matrix would not span the intercept term.

ADD COMMENT

Login before adding your answer.

Traffic: 167 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6