Diagnostics › Method comparison

Segmented (piecewise) regression

Piecewise (segmented / broken-line) regression fits continuous straight-line segments joined at estimated breakpoints where the slope changes, with the Davies test for whether a change exists.

What is Segmented (piecewise) regression?

Many relationships are linear in pieces with an abrupt change in slope — a dose threshold, a growth breakpoint, a ventilatory threshold, a policy kink. A single straight line misses it and a polynomial smears it into a curve; segmented regression estimates both the breakpoint location and the slope on each side, keeping the fitted curve continuous (the segments meet at the break).

Muggeo's algorithm (the `segmented` package) starts from an ordinary linear fit and iteratively relocates the breakpoint until the fit stops improving, giving the breakpoint a standard error. Because the breakpoint is estimated, the usual t-test on the added term is invalid; the Davies test provides a proper p-value for the null of no slope change.

When should I use Segmented (piecewise) regression?

  • A scatter that looks like two (or more) straight lines with a knee.
  • Estimating a threshold / breakpoint and quantifying its uncertainty.
  • Threshold and dose-response work where the change-point itself is the quantity of interest.

What data does it need?

An X (predictor) and Y (response) numeric column + the number of breakpoints (1–3).

What does it report?

Breakpoint estimate(s) with SE and CI, per-segment slopes with SEs, the Davies test p-value, R² and AIC vs a straight line, and the fitted broken line on the scatter.

What does it assume?

  • The mean response is piecewise-linear and continuous in X.
  • Enough data on both sides of each breakpoint to estimate its slope.
  • Usual linear-model error assumptions within segments.

How do I interpret the result?

A small Davies p and a lower segmented AIC support a genuine slope change. A wide breakpoint CI means the location is poorly determined — don't over-interpret its exact value.

Non-convergence usually means too many breakpoints for the data — reduce the count.

See also

References

  • Muggeo (2003). Estimating regression models with unknown break-points. Statistics in Medicine 22.
  • Davies (1987). Hypothesis testing when a nuisance parameter is present only under the alternative. Biometrika 74.