**0**wrote:

Hi everyone,

I've been working with limma but I'm a bit confused about the design of the model matrix which I'm using to determine differential methylation between cases and controls whilst controlling for other covariates, mostly whether I need an intercept? I've been using:

`dm <- (model.matrix(~1 + Status + Gender + Age + Batch,data=pData(dat)))`

fit1 <- lmFit(exprs(dat),dm, method="ls")

fit2 <- eBayes(fit1)

tt <- topTable(fit2,coef=2,genelist=fData(dat)[,c('SYMBOL', 'CHROMOSOME')], adjust.method = "BH")

dm can be created by:

`Status <- as.factor(rep(c(1, 0), times = 14))`

Gender <- as.factor(rep(c(0,1), times = 14))

Age <- as.numeric(c(28:55))

Batch2 <- as.factor(rep(c(1,0,0),length.out=28))

Batch3 <- as.factor(rep(c(0,1,0),length.out=28))

df = data.frame(Status, Gender, Age, Batch2, Batch3)

`dm <- model.matrix(~1 + Status + Gender + Age + Batch2 + Batch3,data=df)`

Reading a question on creating model.matrix using limma and Limma Model Matrix Understanding I'm just not sure whether I'm actually omitting or including an intercept although the model looks like I'm including one (which I think I should be doing since age is continuous and there's other things probably going on which I couldn't include in the model).

Could anyone clarify this please?

**24k**• written 2.1 years ago by Sarah Nesbitt •

**0**