Could you explain in simple language, how adjusting works for categorical variables in regression? Googled without any success.

Let's take a model:

income ~ country + city + money_spent_on_education

Handling of continuous variables:

money_spent_on_education - sets this to mean value while assessing the effects of other predictors

Handling of categorical variables:

county - does regression just equalises the county levels in analysis (e.g. Germany and USA have both same weight on b coefficients)?

city - does regression just equalises the city levels in analysis (e.g. Berlin and New York have both same weight on b coefficients)?


The answer depends on contrasts: how you code these factors and what is your baseline.

A lot of software operates from a perspective of experimental analysis and so takes the first factor level as the baseline and other factor levels just express a difference from that baseline.

There are all sorts of contrasts you can use, as explained at UCLA's IDRE page on contrasts.

Some contrasts will make the intercept represent the grand men and the baseline effect; some will make the intercept be the grand mean; some allow for ordering of factor levels; and, some allow for easily comparing adjacent factor levels.

  • $\begingroup$ (+1) nicely and efficiently stated, with a very useful link. Even the treatment coding that you first describe can differ among software packages; R uses the first level as the reference, while at least one commercial package (SPSS?) uses the last. $\endgroup$
    – EdM
    Aug 8 '20 at 13:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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