Each of the contrasts you've specified will test for a differential effect between P and T, i.e., whether the effect of treatment/time/whatever for factor P is the same as that for factor T. This represents the interaction between the P/T factor and another factor, depending on the exact contrast you're looking at.
If you want to test for a three-factor interaction, that's a bit more complicated. To illustrate, let's use an example:
A <- rep(c("A", "a"), each=4)
B <- rep(c("B", "b"), 4)
E <- rep(rep(c("E", "e"), each=2), 2)
grouping <- factor(paste(A, B, E, sep="."))
design <- model.matrix(~0+grouping)
colnames(design) <- levels(grouping)
Let's treat the lower case as the "baseline", and the upper case as the "treatment" for each factor. Assume that we want to find the three-way interaction effect in the sample with all three treatments, i.e., A.B.E
. This is done with:
con <- makeContrasts(A.B.E - a.b.e # effect of triple treatment
- ((A.b.e - a.b.e) + (a.B.e - a.b.e) + (a.b.E - a.b.e)) # "main effects"
- (((A.B.e - A.b.e) - (a.B.e - a.b.e)) # interaction effect between A and B
+ ((A.b.E - A.b.e) - (a.b.E - a.b.e)) # interaction effect between A and E
+ ((a.B.E - a.B.e) - (a.b.E - a.b.e))), # interaction effect between B and E
levels=design)
The null hypothesis here is that the effect of the triple treatment is equal to the sum of the main effects of the individual treatments and the interaction effects of the pairwise treatments.
Please give more details (i.e., code) as to exactly how you've parameterized your design matrix. I get the impression that you've fitted an additive model for all factors, which will not have any interaction terms.
Hi Aaron,
Thanks for the reply. For now I have made all the treatment as a single factor with design as below. I have 4 factors with 2 level each which makes it 16 single factors. Then I used different contrasts to get the interaction between each factor pairs. This may work for two factors as in Limma manual 9.5.2. However not sure whether this is correct for multi-factors.
This four factors are not blocked. So I'm interested to see the interaction between each pair and also maybe each 3 and even all 4 factors
design <- model.matrix(~0+factor(c(1,1,2,2,2,3,3,4,4,4,5,5,6,6,6,7,7,7,8,8,8,9,9,9,10,10,10,11,11,11,12,12,12,13,13,13,14,14,14,15,15,15,16,16,16)))
colnames(design) <- c("P_Cor_D24", "P_Cor_D6", "P_Cor_ND24", "P_Cor_ND6", "P_Water_D24", "P_Water_D6", "P_Water_ND24", "P_Water_ND6", "T_Cor_D24", "T_Cor_D6", "T_Cor_ND24", "T_Cor_ND6", "T_Water_D24", "T_Water_D6", "T_Water_ND24","T_Water_ND6")
contrast.matrix <- makeContrasts((P_Water_D6-P_Water_ND6)-(T_Water_D6-T_Water_ND6),(P_Water_D24-P_Water_ND24)-(T_Water_D24-T_Water_ND24),(P_Cor_D6-P_Water_D6)-(T_Cor_D6-T_Water_D6),(P_Cor_ND6-P_Water_ND6)-(T_Cor_ND6-T_Water_ND6),(P_Cor_D24-P_Water_D24)-(T_Cor_D24-T_Water_D24),(P_Cor_ND24-P_Water_ND24)-(T_Cor_ND24-T_Water_ND24),(P_Water_D24-P_Water_D6)-(T_Water_D24-T_Water_D6),(P_Water_ND24-P_Water_ND6)-(T_Water_ND24-T_Water_ND6),(P_Cor_D24-P_Cor_D6)-(T_Cor_D24-T_Cor_D6),(P_Cor_ND24-P_Cor_ND6)-(T_Cor_ND24-T_Cor_ND6),levels=design)
Cheers
Bing