I have the following experimental design and want to estimate the differences between nonallergic.BPE vs nonallergic.Medium, allergic.BPE vs. allergic.Medium etc. I would like to use patient as a blocking factor
patient genotype condition 73644 1 nonallergic Medium 73645 1 nonallergic BPE250 73646 2 nonallergic Medium 73647 2 nonallergic BPE250 73648 3 nonallergic Medium 73649 3 nonallergic BPE250 73650 4 allergic Medium 73651 4 allergic BPE250 73652 5 allergic Medium 73653 5 allergic BPE250 73654 6 allergic Medium 73655 6 allergic BPE250 73656 7 allergic Medium 73657 7 allergic BPE250 73877 8 nonallergic Medium 73878 8 nonallergic BPE250
In limma-voom it did it like this:
group <- factor(paste(genotype, condition, sep=".")) design <- model.matrix(~0 + group) vm <- voomWithQualityWeights(y, design=design) corfit <- duplicateCorrelation(vm, design, block = ExpDesign$patient) vm <- voomWithQualityWeights(y, design, block = ExpDesign$patient, correlation = corfit$consensus, plot= TRUE) vfit <- lmFit(vm, design, block=ExpDesign$patient,correlation=corfit$consensus) my.contrasts <- makeContrasts( aMvsnaM = allergic.Medium-nonallergic.Medium, aBPEvsnaBPE = allergic.BPE250-nonallergic.BPE250, aBPEvsaM = allergic.BPE250-allergic.Medium, naBPEvsnaM = nonallergic.BPE250-nonallergic.Medium, levels=design)
When I read about the design formula and matrix in edgeR, I understood that the blocking should be set up like this:
design <- model.matrix(~0+ patient + group)
Unfortunately this gives me a "Design matrix not of full rank" error for following matrix:
patient1 patient2 patient3 patient4 patient5 patient6 patient7 patient8 groupallergic.Medium groupnonallergic.BPE250 groupnonallergic.Medium 1 1 0 0 0 0 0 0 0 0 0 1 2 1 0 0 0 0 0 0 0 0 1 0 3 0 1 0 0 0 0 0 0 0 0 1 4 0 1 0 0 0 0 0 0 0 1 0 5 0 0 1 0 0 0 0 0 0 0 1 6 0 0 1 0 0 0 0 0 0 1 0 7 0 0 0 1 0 0 0 0 1 0 0 8 0 0 0 1 0 0 0 0 0 0 0 9 0 0 0 0 1 0 0 0 1 0 0 10 0 0 0 0 1 0 0 0 0 0 0 11 0 0 0 0 0 1 0 0 1 0 0 12 0 0 0 0 0 1 0 0 0 0 0 13 0 0 0 0 0 0 1 0 1 0 0 14 0 0 0 0 0 0 1 0 0 0 0 15 0 0 0 0 0 0 0 1 0 0 1 16 0 0 0 0 0 0 0 1 0 1 0 attr(,"assign") [1] 1 1 1 1 1 1 1 1 2 2 2 attr(,"contrasts") attr(,"contrasts")$patient [1] "contr.treatment" attr(,"contrasts")$group [1] "contr.treatment"
How do I have to set up my matrix in order to get the differences for my contrasts?
Unfortunately I also don't know whether I should use a model with intercept or not, as we don't have any biological data that would suggest/dissuade that the treatment would have more effect in allergic vs nonallergic patients... Do you have any advice on it? How could I figure out which model would be the right one?
Cheers
