EdgeR model matrix
1
0
Entering edit mode
Luke • 0
@5576e7cd
Last seen 13 months ago
United States

When I create my model matrix for my dge from my DDS one of my conditions is always left out of my model matrix. Looking to have 5 groups in my matrix, only shows 4, how do I fix this? enter image description here

Code should be placed in three backticks as shown below


# include your problematic code here with any corresponding output 
# please also include the results of running the following in an R session 

sessionInfo( )
edgeR RNASeq • 607 views
ADD COMMENT
2
Entering edit mode
@james-w-macdonald-5106
Last seen 44 minutes ago
United States

It's not missing. You are using a treatments contrast, where one level is defined as the baseline (the intercept), and all other levels are differences from that level. For example

> fakeo <- factor(rep(LETTERS[1:4], each = 3))
> model.matrix(~fakeo)
   (Intercept) fakeoB fakeoC fakeoD
1            1      0      0      0
2            1      0      0      0
3            1      0      0      0
4            1      1      0      0
5            1      1      0      0
6            1      1      0      0
7            1      0      1      0
8            1      0      1      0
9            1      0      1      0
10           1      0      0      1
11           1      0      0      1
12           1      0      0      1

In that design matrix, the intercept computes the mean of the A group, and the other three coefficients estimate the difference, so e.d., fakeoB estimates (B - A). That is not always ideal, so you can use a cell means model.

> model.matrix(~ 0 + fakeo)
   fakeoA fakeoB fakeoC fakeoD
1       1      0      0      0
2       1      0      0      0
3       1      0      0      0
4       0      1      0      0
5       0      1      0      0
6       0      1      0      0
7       0      0      1      0
8       0      0      1      0
9       0      0      1      0
10      0      0      0      1
11      0      0      0      1
12      0      0      0      1

And now each coefficient estimates the mean of each group. In which case you need to define contrasts to compare groups, because the mean of the group is not itself interesting.

ADD COMMENT

Login before adding your answer.

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