What are the reference groups in a regression model where there are interaction categories? Using the iris
dataset in R, I've created a category with three levels from the Sepal.Width
variable, and built a linear model with interaction:
data("iris")
iris$SW_cat = as.factor(ifelse(iris$Sepal.Width<3,0,
ifelse(iris$Sepal.Width<3.5,1,2)))
model1 = lm(data=iris, Sepal.Length ~ Species +
SW_cat + Species*SW_cat)
summary(model1)
returns the parameters from the model:
summary(model1)
#>
#> Call:
#> lm(formula = Sepal.Length ~ Species + SW_cat + Species * SW_cat,
#> data = iris)
#>
#> Residuals:
#> Min 1Q Median 3Q Max
#> -1.4381 -0.2539 -0.0381 0.2414 1.3619
#>
#> Coefficients: (1 not defined because of singularities)
#> Estimate Std. Error t value Pr(>|t|)
#> (Intercept) 4.45000 0.32564 13.666 < 2e-16 ***
#> Speciesversicolor 1.35294 0.33508 4.038 8.79e-05 ***
#> Speciesvirginica 1.88810 0.34079 5.540 1.42e-07 ***
#> SW_cat1 0.40385 0.33793 1.195 0.2341
#> SW_cat2 0.78636 0.34012 2.312 0.0222 *
#> Speciesversicolor:SW_cat1 0.01196 0.36564 0.033 0.9739
#> Speciesvirginica:SW_cat1 -0.06886 0.36394 -0.189 0.8502
#> Speciesversicolor:SW_cat2 NA NA NA NA
#> Speciesvirginica:SW_cat2 0.47554 0.44325 1.073 0.2852
#> ---
#> Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#>
#> Residual standard error: 0.4605 on 142 degrees of freedom
#> Multiple R-squared: 0.7052, Adjusted R-squared: 0.6907
#> F-statistic: 48.54 on 7 and 142 DF, p-value: < 2.2e-16
Notably, the output is missing the following interactions:
Speciessetosa:SW_cat0
Speciessetosa:SW_cat1
Speciessetosa:SW_cat2
Does this mean there are three reference groups in such an interaction model? I'm not sure how this can be the case, if a reference group is simply what the other terms are being compared to. Further, what is the interpretation of the intercept, give the model cannot take all three of these reference values at once?