edgeR design matrix not of full rank
1
0
Entering edit mode
adhikb • 0
@adhikb-20158
Last seen 3.9 years ago

Hello, I am performing DEG using edgeR. I am trying to design a matrix so that I can make comparisons control versus treated at different time points taking into account the baseline.

Replicates: 6 (i.e. 6 patients) Conditions: control(C) vs treated(F) Time: 0h (control: 6, which is the baseline(B)) #has only 6 2h (control: 6, treated: 6) 4h (control: 6, treated: 6) 6h (control: 6, treated: 6) 8h (control: 6, treated: 6)

patient= as.factor(rep(c(1:6),each=9))

treatment = factor(c( "B", "C", "F", "C", "F", "C", "F", "C", "F", "B", "C", "F", "C", "F", "C", "F", "C", "F", "B", "C", "F", "C", "F", "C", "F", "C", "F", "B", "C", "F", "C", "F", "C", "F", "C", "F", "B", "C", "F", "C", "F", "C", "F", "C", "F", "B", "C", "F", "C", "F", "C", "F", "C", "F"))

note- Basically B and C are both control. B just refers to something at 0h.

time = factor(c( "0h", "2h", "2h", "4h", "4h", "6h", "6h", "8h", "8h", "0h", "2h", "2h", "4h", "4h", "6h", "6h", "8h", "8h", "0h", "2h", "2h", "4h", "4h", "6h", "6h", "8h", "8h", "0h", "2h", "2h", "4h", "4h", "6h", "6h", "8h", "8h", "0h", "2h", "2h", "4h", "4h", "6h", "6h", "8h", "8h", "0h", "2h", "2h", "4h", "4h", "6h", "6h", "8h", "8h"))

design <- model.matrix(~treatment+treatment:time+patient)

y<-estimateGLMCommonDisp(y,design,verbose=TRUE)

error: Design matrix not of full rank. The following coefficients not estimable: treattypeF:8h

(To make sure if the error is because of 0h "B", I changed it to "C", making only 2 levels for treatments. I still get the same error.)

What am I doing wrong? -Thanks

edger • 906 views
ADD COMMENT
1
Entering edit mode
Aaron Lun ★ 28k
@alun
Last seen 12 hours ago
The city by the bay

Make life easy for yourself and combine treatment and time into a single factor:

combo <- factor(paste0(treatment, ".", time))
design <- model.matrix(~0 + combo + patient)

Each of the first 9 columns represents the average log-expression of each treatment/time combination (in patient 1, technically, but that doesn't matter because we're assuming the patient effects are additive). You can then use makeContrasts to set up comparisons between treatment and control at each time point, e.g.,

con <- makeContrasts(comboF.2h - comboC.2h, levels=design)
ADD COMMENT
0
Entering edit mode

Great! Thank you so much!

ADD REPLY

Login before adding your answer.

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