0
$\begingroup$

I have been working with a data file in R that contains two primary categorical variables : study location (study, 19 levels) which is a nuisance variable and race (4 levels) which is the outcome of interest. There are other variables in the model (age) but as they do not change I don't think they impact my question.

I was originally told to run a logistic regression model where both study and race were dummy coded. E.g. for race:

white  0 0 0
black  1 0 0
latino 0 1 0
asian  0 0 1

The results for whether race was significantly different from white were then interpreted from the regression summary of the beta coefficients and their p-values. However, isn't the interpretation of the raceBlack coefficient, for example, the marginal difference between white and black at the reference of the site variable? I then recoded the site variable to effects coding using contrasts(data$site) = contr.sum(n) yielding, as an example if n=4:

       [,1] [,2] [,3]
site1    1    0    0
site2    0    1    0
site3    0    0    1
site4   -1   -1   -1

This resulted in an expected change to the intercept, but both the estimates and p-values for the race coefficients (still dummy coded) did not change. I thought the new interpretation of the raceBlack coefficient would be, "the difference between white and black at the average of site location." Have I done something incorrectly or does my thinking need correcting?

Thank you for your help.

$\endgroup$

1 Answer 1

0
$\begingroup$

The correct interpretation of the dummy-coded raceBlack coefficient is the associated difference in outcome from the reference level of race when all other predictors are held constant. The particular way the other predictors are coded doesn't matter if race isn't involved in an interaction with any of them.

Things are more complicated when there are interactions. Then the individual coefficient for any predictor can be affected by re-leveling, re-coding, or re-centering a predictor with which it interacts. That's not the case here.

As an aside: if location is just a nuisance variable, you might be better off treating it with a random intercept in a mixed model instead of trying to estimate 18 coefficients for its 19 levels.

$\endgroup$
2
  • $\begingroup$ Thank you for that clarity, I had mixed up interaction interpretations. As a followup, the reference group values (white, site4) involve the intercept, correct? If so, the absolute, but not relative, estimates should still be different, yes? For instance, when both vars are dummy coded the intercept represents white at site 4, but when site is effects coded does the intercept become white at the unweighted average of site? @EdM $\endgroup$
    – aarsmith
    Mar 22, 2023 at 19:43
  • $\begingroup$ @aarsmith I get continually confused by contrasts other than treatment/dummy, so I'd recommend this UCLA web page about what the different contrast codings accomplish and how to interpret the associated intercepts and coefficients, lest I lead you astray. Even with treatment/dummy coding you have to take care, as R by default chooses the lowest level of a categorical predictor as reference, while SPSS chooses the highest level, as I recall. $\endgroup$
    – EdM
    Mar 22, 2023 at 21:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.