Limma: Coefficients not estimable
1
0
Entering edit mode
10 months ago
David ▴ 10

Can someone help with making this design full rank and thereby fix this error:

Coefficients not estimable: GroupPlacebo GenderMale


Does anyone know how to fix this so I can run as contrasts:

cont.matrix = makeContrasts(
ana1=GroupGroup1-GroupPlacebo,
ana2=(GroupGroup1-GenderFemale)-(GroupGroup1-GenderMale),
levels=m)


       (Intercept) GroupGroup1 GroupGroup2 GroupGroup3 GroupPlacebo GenderFemale GenderMale
101_Day1           1           0           0           1            0            1          0
102_Day1           1           0           0           1            0            0          1
103_Day1           1           0           0           1            0            0          1
104_Day1           1           0           0           0            1            1          0
105_Day1           1           0           0           1            0            1          0
106_Day1           1           0           0           0            1            0          1
107_Day1           1           0           0           1            0            1          0
108_Day1           1           0           0           1            0            1          0
109_Day1           1           0           0           1            0            1          0
110_Day1           1           0           0           0            1            1          0
111_Day1           1           0           0           1            0            0          1
112_Day1           1           0           0           1            0            0          1
113_Day1           1           0           0           0            1            0          1
114_Day1           1           0           0           1            0            0          1
115_Day1           1           0           0           1            0            0          1
116_Day1           1           0           0           1            0            1          0
117_Day1           1           0           0           1            0            0          1
118_Day1           1           0           0           0            1            1          0
119_Day1           1           0           0           1            0            0          1
120_Day1           1           0           0           1            0            1          0
201_Day1           1           0           0           0            1            0          1
202_Day1           1           0           1           0            0            0          1
203_Day1           1           0           1           0            0            0          1
204_Day1           1           0           1           0            0            0          1
205_Day1           1           0           1           0            0            1          0
206_Day1           1           0           0           0            1            1          0
207_Day1           1           0           1           0            0            0          1
208_Day1           1           0           1           0            0            0          1
209_Day1           1           0           1           0            0            0          1
210_Day1           1           0           1           0            0            1          0
211_Day1           1           0           0           0            1            0          1
212_Day1           1           0           1           0            0            0          1
213_Day1           1           0           1           0            0            0          1
214_Day1           1           0           0           0            1            1          0
215_Day1           1           0           1           0            0            1          0
216_Day1           1           0           1           0            0            1          0
217_Day1           1           0           1           0            0            0          1
218_Day1           1           0           1           0            0            1          0
219_Day1           1           0           0           0            1            0          1
220_Day1           1           0           1           0            0            1          0
301_Day1           1           1           0           0            0            1          0
302_Day1           1           1           0           0            0            0          1
303_Day1           1           0           0           0            1            1          0
304_Day1           1           1           0           0            0            1          0
305_Day1           1           1           0           0            0            1          0
306_Day1           1           0           0           0            1            1          0
307_Day1           1           1           0           0            0            1          0
308_Day1           1           1           0           0            0            1          0
309_Day1           1           1           0           0            0            1          0
310_Day1           1           0           0           0            1            0          1
311_Day1           1           1           0           0            0            1          0
312_Day1           1           1           0           0            0            0          1
313_Day1           1           1           0           0            0            1          0
314_Day1           1           1           0           0            0            1          0
315_Day1           1           0           0           0            1            0          1
316_Day1           1           1           0           0            0            1          0
317_Day1           1           1           0           0            0            0          1
318_Day1           1           1           0           0            0            0          1
319_Day1           1           0           0           0            1            0          1
320_Day1           1           1           0           0            0            0          1
attr(,"assign")
[1] 0 1 1 1 1 2 2
attr(,"contrasts")
attr(,"contrasts")$Group Group1 Group2 Group3 Placebo Group1 1 0 0 0 Group2 0 1 0 0 Group3 0 0 1 0 Placebo 0 0 0 1 attr(,"contrasts")$Gender
Female Male
Female      1    0
Male        0    1

m<- model.matrix(  ~ Group + Gender , data=X, contrasts.arg = lapply(data.frame(X[,sapply(data.frame(X), is.factor)]),
contrasts, contrasts = FALSE))


RNA-Seq limma R • 721 views
0
Entering edit mode

Please use the formatting bar (especially the code option) to present your post better. You can use backticks for inline code (text becomes text), or select a chunk of text and use the highlighted button to format it as a code block. Like I said before, please avoid using <pre> tags - they override the site's syntax highlighting features.

2
Entering edit mode
10 months ago

You can't estimate placebo effect AND treatment effect, since one is the reverse of the other (i.e., placebo is necesarily the opposite of treatment). Likewise, estimating the effects of male and female makes no sense, since you need some baseline for comparison (i.e., if you measure the effect of being male then you already measured the effect of being female...it's the reverse).

Alternatively, since you want to use contrasts anyway you could also just remove the intercept in your design (~0+Group+Gender).

0
Entering edit mode

So using my design what would I be capturing by the following:

cont.matrix = makeContrasts(
ana1=GroupGroup1,
ana2=GroupGroup1-GenderFemale,
levels=m)


ana1 appears to be finding the DEG using Placebo as a baseline versus Group1

ana2 appears to be finding the DEG using Group1Males as a baseline versus Group1Females

Is this correct if not then what are the two measuring ana1 and ana2 since they both appear to give me the results I expect.

Thank you very much once again

1
Entering edit mode

You can't use your current design matrix because it contains redundancies. Any contrast you form from it will be meaningless.

Just form the design matrix in the standard way, e.g., as suggested by Devon.