How do I make a set of regression coefficients for levels of a categorical predictor sum to 0?

Technote (FAQ)


I'm using a categorical predictor variable and have been instructed to code things so that the coefficients sum to 0. How can I do this?


You're probably being advised to using what's known as effects coding, or deviation contrasts, which compare each level of a categorical factor to the mean of all levels. You can get these easily in SPSS in several procedures, under the name of Deviation contrasts. Note that you actually only get K-1 contrasts for K levels, since the last one is determined by the other K-1 values: it must be the negative of the sum of those values, in order to satisfy the sum to 0 condition.

If you want to code your own variables this way, here's how to proceed:

1) Choose a category to leave out. Code that category as -1 for all K-1 variables.
2) For each other category, code a variable as 1 if a case is in that category.
3) All other values are 0.

Historical Number


Document information

More support for:

SPSS Statistics

Software version:

Not Applicable

Operating system(s):

Platform Independent

Reference #:


Modified date:


Translate my page

Content navigation