**by Jeff Meyer**

We often have a continuous predictor in a model that we believe has non-constant relationship with the dependent variable along the predictor’s range. But how can we be certain? What is the best way to measure this?

Sometimes including a quadratic term will capture the change in the slope as we move from the bottom of the range to the top of the range. But a quadratic term only works in two situations:

- The rate of change increases and then at some point decreases, or:
- The opposite happens – the rate of change decreases and at some point increases.

We could also create a categorical variable. Each category within the categorical variable would represent a specific range within the continuous variable.

However, the coefficients for the new categorical variable would no longer represent the expected change in the dependent variable per unit change in the predictor.

The coefficients would represent the mean change in the dependent variable as compared to the base category of the predictor.

You could also split your data set into subset data sets. Each new data set would consist of different ranges of your continuous predictor. But there are several issues that could arise from this. For example, the power of your analysis could be significantly diminished. Your ability to test for interactions might also be impacted. So this is not an approach that I would recommend using.

I would suggest running a segmented (or piecewise) regression. A segmented regression allows you to generate different slopes for specific values of your continuous predictor. Instead of having several separate models, you have just one.

For example, let’s look at regressing income (in thousands of dollars) on years of education:

For every year of education, we expect income to increase by approximately $3,949. It doesn’t matter what level of education one has obtained. Put in an additional year of schooling and you’ll make an additional $3,949 per year.

Here’s the graph of this model:

Does it make sense that this rate of increase would remain the same for each level of education? For example, does someone with 11 years of education make about $4,000 less than someone with a high school education?

Well, we can make a split at 11.99 years of education to find out:

The first slope, educ1a, is the increase in salary per year of education up to 12 years. For example, someone who went to school up to 11th grade would earn, on average, 10,352 + 11 x 1,040 = $21,792 per year.

Those with more than 12 years of education would earn an additional $4,938 per year for every year of education greater than 12.

Notice in the graph of this model that the y-intercept is no longer -21:

Should we expect an increase for those with a college degree compared to those with 1 to 3 years of college? Let’s add an additional segmentation to find out.

We have now modeled three different slopes for expected salary per number of years of education. The table below shows the average income levels at specific years of education.

Here’s the graph of this model:

Years of Education |
Formula |
Mean Income in Thousands |

11.999 |
$9.061 +( 11.999 x 1.23) |
$23.85 |

13 |
$9.061 +( 11.999 x 1.23)+(1 x 4.13) |
$27.99 |

15.99 |
$9.061 +( 11.999 x 1.23)+ (4 x 4.13) |
$40.40 |

17 |
$9.061 +( 11.999 x 1.23)+ (4 x 4.13)+(1 x 6.43) |
$46.82 |

### Related Posts

- April 2017 Member Webinar: Segmented Regression
- 3 Situations when it makes sense to Categorize a Continuous Predictor in a Regression Model
- Proportions as Dependent Variable in Regression–Which Type of Model?
- Understanding Interactions Between Categorical and Continuous Variables in Linear Regression