Design Matrix for multiple variables in Edge R
0
1
Entering edit mode
@6fc08061
Last seen 3.2 years ago

Hi ,

I am working on longitudinal analysis. I have to perform DE between 2 groups of patients between T0-->T1

The variables in my design are Time (Visit1==T0, Visit2==T1), Sex(Male, Female), Status(RA, C) and Subject(Patient Numbers).

Samples are paired and each group has male and female samples This is how I set up my design matrix.


#MetaData
LTR_ID  Visit Disease Sex  Subject
LTR010  1       0       F   1
LTR093  2       0       F   1
LTR012  1       1       M   1
LTR094  2       1       M   1
LTR017  1       1       M   2
LTR095  2       1       M   2
LTR096  1       1       F   3
LTR097  2       1       F   3

design <- model.matrix(~status + sex + status:subject + status:time)
colnames(design)

 [1] "(Intercept)"        "statusRA"           "sexM"               "statusC:subject2"  
 [5] "statusRA:subject2"  "statusC:subject3"   "statusRA:subject3"  "statusC:subject4"  
 [9] "statusRA:subject4"  "statusC:subject5"   "statusRA:subject5"  "statusC:subject6"  
[13] "statusRA:subject6"  "statusC:subject7"   "statusRA:subject7"  "statusC:subject8"  
[17] "statusRA:subject8"  "statusC:subject9"   "statusRA:subject9"  "statusC:subject10" 
[21] "statusRA:subject10" "statusRA:subject11" "statusRA:subject12" "statusRA:subject13"
[25] "statusRA:subject14" "statusRA:subject15" "statusRA:subject16" "statusRA:subject17"
[29] "statusRA:subject18" "statusRA:subject19" "statusRA:subject20" "statusRA:subject21"
[33] "statusRA:subject22" "statusRA:subject23" "statusC:time2"      "statusRA:time2" 

#testing for DE with patients at T0 vs T1

y  <- estimateDisp(y, design)

==>Error in glmFit.default(sely, design, offset = seloffset, dispersion = 0.05, : 
Design matrix not of full rank. The following coefficients not estimable: statusRA:subject19

I get the above error. I am doing a pair wise analysis where I want to check for DE between patients at T0 vs T1. I need to account for Sex as a covariate and do the analysis. Looks like I am setting up the design matrix wrong. I have 2 questions, Does doing pairwise analysis account for gender effect? If not, What would be the best way to set ithe design?

designmatrix DifferentialExpression edgeR RNAseq • 616 views
ADD COMMENT

Login before adding your answer.

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