9.4 Piecewise linear regression

Indicators also let the shape of a relationship change at a known value of \(x\). Suppose the slope changes at \(x = t\), but the relationship stays continuous. Let \[ (x - t)_+ = \begin {cases} 0 , & x \le t , \\ x - t , & x > t , \end {cases} \] which is \((x - t)z\) with \(z\) the indicator of \(x > t\). The model \[ y = \beta _0 + \beta _1x + \beta _2(x - t)_+ + \varepsilon \] has mean \(\beta _0 + \beta _1x\) for \(x \le t\) and \(\beta _0 + \beta _1x + \beta _2(x - t) = (\beta _0 - \beta _2t) + (\beta _1 + \beta _2)x\) for \(x > t\). The two pieces meet at \(x = t\), and the slope changes by \(\beta _2\) there. The point \(t\) is called a knot, and the fitted curve is a linear spline. Testing \(H_0\colon \beta _2 = 0\) tests whether the slope changes. If the relationship may also jump at \(t\), add \(z\) itself as a regressor. (When the knot is unknown, the model is non-linear in \(t\); that case belongs to the section on non-linear estimation.)

Questions on this section

Stuck on something here? Ask below and it stays attached to this topic.