Limma: Use numeric available in makecontrast
1
0
Entering edit mode
jial2 • 0
@jial2-7016
Last seen 7.9 years ago
United States

Dear R users,

I have a project that needs to use linear model of limma to do the contrast analysis, but the difficult is to use numeric variable in the contrast. We would like to use Batch as random effect, Stage as numeric variable and Age as co-variate in analysis. But I don't know how to set the contrast using Stage (numeric variable with 0,1,2,3 on 4 different stages). The comparison will be 1+2+3 (represent the post-infection) to 0 (pre-infection), I don't know if there is a way to solve this in limma or other package.

Thanks a lot and appreciate it for any input.

Best,

Li

 

limma • 1.5k views
ADD COMMENT
0
Entering edit mode

Some more detail on the samples would be appreciated. For example, include a metadata table that shows the value of Batch, Stage and Age for each sample in your dataset.

ADD REPLY
1
Entering edit mode
@gordon-smyth
Last seen 1 minute ago
WEHI, Melbourne, Australia

From your description, your experiment should be straightforward to analyse using limma. However I think there is some confusion about numeric covariates vs factors.

If you want to form a contrast of Stage 1+2+3 vs 0, then Stage must be declared as a factor rather than simply as a numeric variable.

I am guessing that if you simply declare Stage <- factor(Stage), and then redo the analysis, that the difficulties you may be having will go away.

ADD COMMENT
0
Entering edit mode

To follow up, if you have a design matrix like this:

Stage <- factor(c(0,0,1,1,2,2,3,3))
design <- model.matrix(~0+Stage)

Then you would set up your contrast like this (compare the average of Stages 1 to 3 against Stage 0):

cont.mat <- makeContrasts((Stage1+Stage2+Stage3)/3-Stage0, levels=design)

You can use cont.mat in contrasts.fit, and apply eBayes and topTable to get the DE genes.

ADD REPLY

Login before adding your answer.

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