model matrix in limma
1
0
Entering edit mode
gv ▴ 40
@gv-6516
Last seen 2.2 years ago
United States

Hi, I am trying to build a model matrix in limma to perform differential analysis of my features. I have a simple phenodata like this:

Sample  condition
dmso_1  control
dmso_2  control
dmso_3  control
pi3_1   drug
pi3_2   drug
pi3_3   drug

I want to see differential changes 2 conditions control and drug. I have seen from tutorial videos that you can either include the intercept or not. What I don't understand is sometimes ~-1 is used, sometimes ~1 or ~0 is used. Can you tell whether my matrix will work and what exactly is the difference between coefficients?

design <- model.matrix(~-1 + factor(rep(1:2, each=3)))
colnames(design) <- c("dmso","pi3")
contrast <- makeContrasts(dmso - pi3, levels = design)
fit <- lmFit(file.mat, design)
fit2 <- contrasts.fit(fit, contrast)
fit2 <- eBayes(fit2)

Also if I don't want to use the intercept, how can I build the matrix?

Thanks

limma R • 975 views
ADD COMMENT
1
Entering edit mode
@gordon-smyth
Last seen 2 hours ago
WEHI, Melbourne, Australia

See Section 9.2 of the limma User's Guide.

In R, ~0 and ~-1 are the same thing while ~1 is superfluous and possibly an error in whatever tutorial you have read.

ADD COMMENT

Login before adding your answer.

Traffic: 516 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