Hi,
I have a linear model:
model <- model.matrix(~0 + SNF + CRS)
Both factors are categorical, where SNF has 3 levels (1, 2, or 3), and CRS has 2 levels (high or low)
Initially we were interested in comparing each SNF group against the others using the planned contrasts:
contrasts <- makeContrasts(
SNF1 - (SNF2 + SNF3) / 2,
SNF2 - (SNF1 + SNF3) / 2,
SNF3 - (SNF1 + SNF2) / 2,
levels=model)
Now we want to add the second factor of CRS so that we can compare the group differences within and between CRS for SNF. I'm having some conceptual difficulties determining the right contrast formula.
E.g., we want to compare say SNF1&high VS SNF1&low.
Would this be equal to?: (SNF1 + CRS_high) - (SNF1 + CRS_low)
For between comparisons, E.g., we want to perfom the planned contrasts as listed above but for either high or low CRS, separately.
This I'm not even sure how to form, and I'm confused on how I would tell makeContrast to effectively subset the data in this contrast.
Ah I think I see, I have to specify an interaction, like so:
Just want to confirm, is this accurate?
Eh, it doesn't look right. For some reason, model.matrix is omitting two of the interactions for SNF1:
Whereas it should include both snf1:crsHigh and snf1:crsLow.