# Changepoints in linear regression (NOT piecewise regression)

I have two variables, X and Y, whose relationship can be described well by a linear regression. HOWEVER, this relationship changes every once in a while. It is not that the relationship changes depending on the X value (like a piecewise regression), but that for example, for rows 1-100, the true relationship is Y=X+2, but for rows 101-200, the true relationship is Y=X+4 (so notice, again, this is not a case of needing a piecewise linear regression, but a "shift"/change in the linear relationship).

Are there any techniques/tools to detect such shifts online/live? As in, if I have these points being fed to me 1 point at a time, is there any way to identify that, for example at row 110, it's clear that the relationship from rows 1-100 is no longer valid?

Thank you!

I've been reading about breakpoint detection in regression problems, but that seems to be related to finding optimal spots to split piecewise regression? Which isn't what I need.

• Since this is an online setting, maybe look into control-chart. Mar 16, 2022 at 21:18
• @kjetilbhalvorsen Thank you for the suggestion, I'll check that page out right now. Mar 16, 2022 at 21:21
• @kjetilbhalvorsen Unfortunately, it seems like more or less all those questions focus on a time-series, univariate setting. However, in this case, I guess you could say it's a bivariate time-series setting (since there's a slope + intercept), or otherwise seems a bit different (since it's not detecting a change in the mean, unless you're talking about the mean SLOPE). But again, I really don't know how to approach this. Mar 16, 2022 at 21:25

In the structural change literature this is also referred to as "monitoring" structural changes in linear regression models. A set of classic techniques is available in the strucchange package in R and the corresponding papers/vignette/manual gives further pointers to the literature. The techniques would usually monitor both intercept and slope.