I have six conditions. We can call them A, B, C, D, E, F.
I am trying to create a contrast matrix in R. I will use these contrasts in a regression model.
#Compare A, B, C to D, E, F
contrast1 <- c(1/3, 1/3, 1/3, -1/3, -1/3, -1/3)
#Next compare A and D to C and F.
contrast2 <- c(1/2, 0, -1/2, 1/2, 0, -1/2)
#Next compare B and E to C and F
contrast3 <- c(0, 1/2, -1/2, 0, 1/2, -1/2)
#Next compare A and D to B and E
contrast4 <- c(1/2, -1/2, 0, 1/2, -1/2, 0)
#Create interaction
contrast.interaction <- contrast1 * contrast4
mat.temp <- rbind(constant=1/6, contrast1, contrast2, contrast3, contrast4, contrast.interaction)
mat.temp
mat <- solve(mat.temp)
The error I get is:
Error in solve.default(mat.temp) : Lapack routine dgesv: system is exactly singular: U[6,6] = 0
So I understand it is singular, but I do not understand how/why? Which contrast(s) contribute to this problem?