My design matrix is below for an RNASeq experiment and somewhat similar to Section 3.4.2 Blocking in the manual I'm trying to follow,
sample condition mouse
ctrl_minus_1 ctrl_minus 1
ctrl_plus_1 ctrl_plus 1
ko_minus_1 ko_minus 2
ko_plus_1 ko_plus 2
ctrl_minus_2 ctrl_minus 3
ctrl_plus_2 ctrl_plus 3
ko_minus_2 ko_minus 4
ko_plus_2 ko_plus 4
ctrl_minus_3 ctrl_minus 5
ctrl_plus_3 ctrl_plus 5
ko_minus_3 ko_minus 6
ko_plus_3 ko_plus 6
Where the design is as follows, two conditions (ctrl/ko) and for each treated/untreated with a drug (plus/minus). Un/treated are paired from the same mouse and I want to take that into consideration the mouse-level variability...
My model is,
design <- model.matrix(~mouse + condition)
and the comparisons of interest are,
my.contrasts <- makeContrasts(ctrl_plus_minus=conditionctrl_plus, ko_plus_minus=conditionko_plus - conditionko_minus, ctrl_plus=conditionko_plus - conditionctrl_plus,
ctrl_minus=conditionko_minus, ctrl_vs_ko= conditionctrl_plus - (conditionko_plus - conditionko_minus), levels=design)
which gives the following error,
> my.DGEList <- estimateGLMCommonDisp(my.DGEList, design, verbose=TRUE)
Error in glmFit.default(y, design = design, dispersion = dispersion, offset = offset, :
Design matrix not of full rank. The following coefficients not estimable:
conditionko_plus
Calls: estimateGLMCommonDisp ... f -> adjustedProfileLik -> glmFit -> glmFit.default
Execution halted
I tried including the intercept in the model,
design <- model.matrix(~0 + condition + mouse)
my.contrasts <- makeContrasts(ctrl_plus_minus=conditionctrl_plus - conditionctrl_minus, ko_plus_minus=conditionko_plus - conditionko_minus, ctrl_plus=conditionko_plus - conditionctrl_plus,
ctrl_minus=conditionko_minus - conditionctrl_minus, ctrl_vs_syk= (conditionctrl_plus - conditionctrl_minus) - (conditionko_plus - conditionko_minus), levels=design)
but get a similar error,
my.DGEList <- estimateGLMCommonDisp(my.DGEList, design, verbose=TRUE)
Error in glmFit.default(y, design = design, dispersion = dispersion, offset = offset, :
Design matrix not of full rank. The following coefficients not estimable:
mouse6
Calls: estimateGLMCommonDisp ... f -> adjustedProfileLik -> glmFit -> glmFit.default
Execution halted
Why is the design matrix not of full rank?
Thanks,
Prat