# Inconsistent beta values in regression analysis due to change in categorical coding

I have three terms in my regression models:

• gender (categorical data),
• centeredmeanB (quantitative data)
• and the interaction term gender * centeredmeanB.

I noticed than the way I coded gender gave me different beta values

If I coded Male: 0, Female:1

 => beta values (gender=-.388,centeredmeanB=-.799, gender *centeredmeanB=.675)


If I coded Male:-1, Female:1

 => beta values (gender=-.388, centeredmeanB=-.313, gender*centeredmeanB=.456)


If I coded Male:1, Female:2

 => beta values (gender=.388, centeredmeanB=-1.771, gender*centeredmeanB=1.539)


I found these results confusing since I read that greater beta values are better, but in my case the beta values are different depending on how I code the categorical data. Any idea on which one I should use for my analysis?

NB: the beta values refer to standardized coefficients.

## 2 Answers

Of course they are different, because the three interaction terms are different. In your scheme one, all the data in your centered variable "quant" will turn to 0 if the subject is a male (int1).

In your scheme two, all the data in your centered variable "quant" will change sign if the subject is a male (int2).

In your scheme three, all the data in your centered variable "quant" will be as is if it is from a male, but double if it's from a female (int3).

Now, a couple points for the upcoming discussion:

1. int1, int2, and int3 are three different variables and they have different means and standard deviations. If you feed a third variable into a regression model, the coefficients of the two per-exisiting predictors' may change. This is extremely common for continuous predictors that are not 100% independent from each other.

2. Standardized coefficient is just the original coefficient adjusted by the ratio of SD(x) and SD(y): $Standardized\beta x_i = \beta x_i \frac{SD_{xi}}{SD_y}$

Because of the above two points, the final standardized coefficients can change. The standardized coefficient of centeredmeanB changes because you add a different third variable into the model, causing its coefficient to change. Once it changes, the standardized beta also changes even the SD of centeredmenaB remains the same.

The changes in the interaction terms is easier to perceive: they are different variables.

If you use generalized linear model to try this one more time, you should see that scheme number one is the closest to how interaction terms are usually tested. I'd suggest sticking to 1/0 coding for binary variables, the coefficients would make more sense, the intercept makes more sense, and the interaction calculated from it is likely to cause fewer mishaps.

A better advice, though, is to capitalize on the generalize linear model module in SPSS. Users can specify if the variable is categorical or continuous. That way no matter how you code your gender variable, the results will always be consistent.

1. Bigger beta values are not necessarily "better". If you recode a variable to another measure, beta values will change. E.g. change "income" from "dollars" to "millions of dollars" and the beta value will be 1,000,000 times as big, but it will mean the same

2. Of course if you recode variables the beta values will change. Neither recoding is "better", it's just a question of what you find easiest to interpret. I find dummy coding easier to interpret than effect coding, but the meaning is the same.

Note: This is assuming that "beta" ($\beta$) is the unstandardized coefficient; in output, these are often labeled B rather than $\beta$

• "Betas" usually refer to standardized coefficients, which remain invariant under changes of scale of any of the variables. – whuber Mar 19 '13 at 19:16
• @whuber You're right, but I think this question may be using "beta" for unstandardized parameter estimates. I've seen that a lot too. Indeed, in the usual formulas for OLS, I see betas all the time, with no mention of standardization. – Peter Flom Mar 19 '13 at 19:19
• If you suspect the OP in any question might be misusing a standard term, Peter, then please call that out: a request for clarification in a comment is a good method, but if you feel you need to post a reply, at a minimum please explain what interpretation you are making, rather than continuing with a usage you think is ambiguous! – whuber Mar 19 '13 at 19:22
• Hi Peter and Whuber, the beta values mentioned refer to standardized coefficients. There were obtained in spss. – clara Mar 19 '13 at 19:54