This question has an UPDATE.
There is a nice answer HERE regarding how to interpret regression coefficients when predictors each consist of two categories in R
. But imagine we have students' sex (boys
, girls
) and the school-gender system (boy-only
, girl-only
, mixed
) in a model like: y ~ sex + schoolgend
.
Here, we expect 4 coefficients. I wonder how to interpret the third coefficient (+.175 see below)?
Say, the (Intercept)
represents the boys
mean in mixed
schools:
Estimate
(Intercept) -0.189
schgendboy-only 0.180
schgendgirl-only 0.175 <-- This one!
sexgirls 0.168
My interpretations of the coefficients are as follows:
(intercept): mean of y for boys in mixed schools = -.189
schgendboy-only: diff. bet. boys in boy-only vs. mixed schools = +.180
schgendgirl-only: diff. bet. ?????????????????????????????????? = +.175
sexgirls: diff. bet. girls vs. boys in mixed schools = +.168
If my interpretation logic for all other coefs is correct, then, this third coef. (schgendgirl-only
) must mean:
diff. bet. boys in girl-only vs. mixed schools = +.175! (which makes no sense!)
ps. I know I will end-up interpreting +1.75 as: diff. bet. girls in girl-only vs. mixed schools BUT this doesn't follow the interpretation logic for other coefs PLUS there are no labels in the output to show what's what!
UPDATE
It seems that schgendgirl-only
can meaninglessly represent: diff. bet. boys in girl-only vs. mixed schools just like it can meaningfully represent: diff. bet. girls in girl-only vs. mixed schools
The reason is that the two coefficients are exactly equal. Here is a reproducible R
demonstration (results are shown to 4 decimal places):
library(R2MLwiN) # For the dataset
library(lme4) # For Model fitting
library(emmeans) # For pairwise contrasts
data("tutorial")
Form <- normexam ~ 1 + standlrt + schgend + sex + (standlrt | school)
model <- lmer(Form, data = tutorial, REML = FALSE)
emmeans(model, pairwise~schgend+sex)$contrast
#contrast estimate SE df z.ratio p.value
#mixedsch boy - boysch boy -0.17986 0.0991 Inf -1.814 0.4565
#mixedsch boy - girlsch boy -0.17482 0.0788 Inf -2.219 0.2287<--This coef. equals
#mixedsch boy - mixedsch girl -0.16826 0.0338 Inf -4.975 <.0001
#mixedsch boy - boysch girl -0.34813 0.1096 Inf -3.178 0.0186
#mixedsch boy - girlsch girl -0.34308 0.0780 Inf -4.396 0.0002
#boysch boy - girlsch boy 0.00505 0.1110 Inf 0.045 1.0000
#boysch boy - mixedsch girl 0.01160 0.0997 Inf 0.116 1.0000
#boysch boy - boysch girl -0.16826 0.0338 Inf -4.975 <.0001
#boysch boy - girlsch girl -0.16322 0.1058 Inf -1.543 0.6361
#girlsch boy - mixedsch girl 0.00656 0.0928 Inf 0.071 1.0000
#girlsch boy - boysch girl -0.17331 0.1255 Inf -1.381 0.7388
#girlsch boy - girlsch girl -0.16826 0.0338 Inf -4.975 <.0001
#mixedsch girl - boysch girl -0.17986 0.0991 Inf -1.814 0.4565
#mixedsch girl - girlsch girl -0.17482 0.0788 Inf -2.219 0.2287<--This coef.
#boysch girl - girlsch girl 0.00505 0.1110 Inf 0.045 1.0000