Mathwords logoMathwords

Segmented Regression — Definition, Formula & Example

Segmented regression is a way of fitting data with two or more straight-line pieces that meet at points called breakpoints. You use it when a trend runs at one rate and then clearly switches to a different rate.

For one breakpoint cc, the continuous segmented regression model is y=β0+β1x+β2(x−c)++εy = \beta_0 + \beta_1 x + \beta_2 (x - c)_+ + \varepsilon, where (x−c)+=max⁡(0, x−c)(x - c)_+ = \max(0,\, x - c) is the hinge term. The coefficients β0,β1,β2\beta_0, \beta_1, \beta_2 are estimated by least squares. The breakpoint cc is either fixed in advance or estimated by searching for the value that minimizes the residual sum of squares. The slope is β1\beta_1 for x<cx < c and β1+β2\beta_1 + \beta_2 for x>cx > c.

Key Formula

y^=β0+β1x+β2max⁡(0, x−c)\hat{y} = \beta_0 + \beta_1 x + \beta_2 \max(0,\, x - c)
Where:
  • y^\hat{y} = Predicted value of the response variable
  • xx = Value of the explanatory variable
  • cc = Breakpoint, the x-value where the slope changes
  • β0\beta_0 = Intercept of the left segment
  • β1\beta_1 = Slope of the left segment, where x is less than c
  • β2\beta_2 = Change in slope at the breakpoint, so the right segment has slope beta 1 plus beta 2

Worked Example

Problem: A town records daily water use yy (thousands of gallons) against the day's high temperature xx (°F). Software fits a segmented regression and estimates a breakpoint at c=70c = 70°F. The fitted model is y^=20+0.5x+1.5max⁡(0, x−70)\hat{y} = 20 + 0.5x + 1.5\max(0,\, x - 70). Find the slope of each segment, then predict water use on a 60°F day and on an 80°F day.
Step 1: Below the breakpoint, the hinge term is 0, so the slope is β1\beta_1. Above it, the hinge term adds β2\beta_2 to the slope.
left slope=0.5,right slope=0.5+1.5=2.0\text{left slope} = 0.5, \qquad \text{right slope} = 0.5 + 1.5 = 2.0
Step 2: For x=60x = 60, the value x−70=−10x - 70 = -10 is negative, so the hinge term is 0. Only the left line applies.
y^=20+0.5(60)+1.5(0)=50\hat{y} = 20 + 0.5(60) + 1.5(0) = 50
Step 3: For x=80x = 80, the hinge term is 80−70=1080 - 70 = 10, so the extra slope kicks in for those 10 degrees.
y^=20+0.5(80)+1.5(10)=20+40+15=75\hat{y} = 20 + 0.5(80) + 1.5(10) = 20 + 40 + 15 = 75
Answer: Water use rises 0.5 thousand gallons per °F below 70°F and 2.0 thousand gallons per °F above it. The model predicts 50 thousand gallons at 60°F and 75 thousand gallons at 80°F. Both pieces give 55 at x=70x = 70, so the line bends without jumping.

Why It Matters

Segmented regression finds thresholds. Examples include the temperature where cooling demand surges, the dose where a drug stops helping, and the year a policy changed a trend. It appears in college statistics and econometrics courses, and in environmental science and public health research, where the location of the breakpoint is often the main result.

Common Mistakes

Mistake: Splitting the data at the breakpoint and running two separate least-squares lines.
Correction: Two independent fits usually do not meet at x=cx = c, which creates a jump the data may not support. They also ignore the uncertainty in the breakpoint itself. Fit one model with the hinge term max⁡(0,x−c)\max(0, x - c). This forces the segments to connect, and it lets you estimate all coefficients, including cc, together.

Related Terms