I'm having trouble finding information on helping me understand how to interpret non-orthogonal contrasts in a regression model.
I have simulated some data to show what I am working with:
set.seed(5552)
Subject <- 1:30
Group <- c(rep("Control", times = 10), rep("Experimental 1", times = 10), rep("Experimental 2", times = 10))
Pre <- round(rnorm(n = Subject, mean = 25, sd = 5), 1)
Post <- c(round(rnorm(n = 10, mean = 25, sd = 5), 1),
round(rnorm(n = 10, mean = 28, sd = 3),1),
round(rnorm(n = 10, mean = 33, sd = 4),1))
dat <- data.frame(Group, Subject, Pre, Post)
dat$Diff <- with(dat, Post - Pre)
dat
Model 1: Here is the regression model using the default contrasts in R:
model1.lm <- lm(Diff ~ Group, data = dat)
summary(model1.lm)
Call:
lm(formula = Diff ~ Group, data = dat)
Residuals:
Min 1Q Median 3Q Max
-17.250 -2.958 -0.015 3.743 13.950
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.750 1.960 0.383 0.70495
GroupExperimental 1 3.530 2.772 1.274 0.21365
GroupExperimental 2 8.430 2.772 3.042 0.00519 **
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 6.197 on 27 degrees of freedom
Multiple R-squared: 0.2569, Adjusted R-squared: 0.2018
F-statistic: 4.666 on 2 and 27 DF, p-value: 0.01817
The interpretation here is easy as each coefficient is the difference between that group and the reference (control) group, reflected as the intercept.
Model 2: Now, I change the contrasts to orthogonal:
contrast1 <- c(-2,1,1)
contrast2 <- c(0,1,-1)
contrasts(dat$Group) <- cbind(contrast1, contrast2)
Now re-run the regression model:
model1.lm2 <- lm(Diff ~ Group, data = dat)
summary(model1.lm2)
Call:
lm(formula = Diff ~ Group, data = dat)
Residuals:
Min 1Q Median 3Q Max
-17.250 -2.958 -0.015 3.743 13.950
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 4.7367 1.1315 4.186 0.00027 ***
Groupcontrast1 1.9933 0.8001 2.491 0.01917 *
Groupcontrast2 -2.4500 1.3858 -1.768 0.08837 .
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 6.197 on 27 degrees of freedom
Multiple R-squared: 0.2569, Adjusted R-squared: 0.2018
F-statistic: 4.666 on 2 and 27 DF, p-value: 0.01817
Okay, this output makes sense. The intercept now reflects the grand mean. The coefficient for contrast 1 (1.99) is the difference between the pooled mean of the 2 experimental groups and the control group, divided by3. The coefficient for contrast 2 now represents the difference between experimental group 2 and experimental group 3, divided by 2.
Model 3: Now, what if I make the contrasts non-orthogonal. I'll keep the first contrast the same (Control Group vs Both Experimental Groups) and change the second contrast to the Control Group vs Experimental Group 2. Because the Control group is entered back into another contrast, this analysis is non-orthogonal. Here are the contrasts:
contrast1 <- c(-2,1,1)
contrast2 <- c(-1,0,1)
contrasts(dat$Group) <- cbind(contrast1, contrast2)
Now re-run the regression:
model1.lm3 <- lm(Diff ~ Group, data = dat)
summary(model1.lm3)
Call:
lm(formula = Diff ~ Group, data = dat)
Residuals:
Min 1Q Median 3Q Max
-17.250 -2.958 -0.015 3.743 13.950
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 4.7367 1.1315 4.186 0.00027 ***
Groupcontrast1 -0.4567 1.6002 -0.285 0.77753
Groupcontrast2 4.9000 2.7716 1.768 0.08837 .
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 6.197 on 27 degrees of freedom
Multiple R-squared: 0.2569, Adjusted R-squared: 0.2018
F-statistic: 4.666 on 2 and 27 DF, p-value: 0.01817
How do I best interpret these non-orthogonal contrasts? The intercept is the same as the orthogonal model, the grand mean. Coefficient 1 has changed yet the contrast is the same as the orthogonal model, it doesn't really make sense to me as to why? I can't make sense of the 2nd coefficient either.
solve(cbind(1, contrast1, contrast2))
. I'll add a more detailed answer when I have time to do so. $\endgroup$