Problem in identifying model matrix
1
0
Entering edit mode
6.2 years ago
Naim.Mahi ▴ 40

Hi all,

I am working on a RNA-Seq data where my factor set looks like the following:

Type       Patient            Time
C             3                T0
C             3                T1
C             8                T0
C             8                T1
C             9                T0
C             9                T1
C            10                T0
C            10                T1
C             5                T1
C            11                T1
A            1                 T0
A            1                 T1
A            4                 T0
A            4                 T1
A            6                 T0
A            6                 T1
A            7                 T0
A            2                 T1

Here, I want to see the change in expression at time T1 between C and A.

I tried to specify the model matrix in edgeR as:

design <- model.matrix(~Type+patient+Type:Time)

But, when I tried to use "estimateGLMCommonDisp" command, it shows an error saying that the design is not of full rank.

RNA-Seq R software error edgeR ModelMatrix • 2.1k views
1
Entering edit mode

Hint: Type is a linear combination of patient, which is causing the error.

0
Entering edit mode

Patient is nested within Type. I want to consider Patient as a block effect while testing for change at time T1 between C and A. Just can't reach the exact idea here!

0
Entering edit mode

is the lowercase patient here a typo?  design <- model.matrix(~Type+patient+Type:Time)

cause it appears uppercase in the matrix

0
Entering edit mode

Nope. It's all good in the case. It is actually "patient", I wrote here with upper-case! Problem is in specifying the model matrix.

0
Entering edit mode
6.2 years ago

What I was trying to get at with my hint is that if you include patient you then have no use for Type (the Type effect is completely determined by the patient effect). So ~patient+Type:Time.

BTW, you'll probably need to get rid of some patients too. There are 4 (2, 5, 7, and 11) that are uninformative.

0
Entering edit mode

It's still showing the same problem, even after getting rid of these patients !!
"Error in glmFit.default(y, design = design, dispersion = dispersion, offset = offset,  :
Design matrix not of full rank.  The following coefficients not estimable:
TypeA:TimeT1 TypeC:TimeT1"
This is the error I'm getting.

0
Entering edit mode

If you keep time as a factor, then you're asking the model to fit a coefficient for the each of the 4 Type:Time combinations. Consequently, you have things like TypeA:T0 and TypeA:T1, which are the sum of patients in the TypeA group. If you instead use Type as a numeric, then you'll find that it works (and it should answer the question you want).