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?

Should the design matrix for removeBatchEffect include an intercept?

0

Entering edit mode

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?

0

Entering edit mode

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.

Similar Posts

Loading Similar Posts

Traffic: 314 users visited in the last hour

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