Question: Limma Model Design
gravatar for Sarah Nesbitt
3 months ago by
Newcastle University
Sarah Nesbitt0 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?

ADD COMMENTlink modified 3 months ago by Aaron Lun16k • written 3 months ago by Sarah Nesbitt0
gravatar for Aaron Lun
3 months ago by
Aaron Lun16k
Cambridge, United Kingdom
Aaron Lun16k wrote:

You are including an intercept with ~1. However, it doesn't really matter whether you include the intercept or not, provided that you correctly interpret the coefficients. The meaning of each term will change if you drop the intercept, even if the columns of the design matrix have the same names.

ADD COMMENTlink modified 3 months ago • written 3 months ago by Aaron Lun16k
Please log in to add an answer.


Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.2.0
Traffic: 288 users visited in the last hour