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.

  • $\begingroup$ Since this is an online setting, maybe look into control-chart. $\endgroup$ Mar 16, 2022 at 21:18
  • $\begingroup$ @kjetilbhalvorsen Thank you for the suggestion, I'll check that page out right now. $\endgroup$ Mar 16, 2022 at 21:21
  • $\begingroup$ @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. $\endgroup$ Mar 16, 2022 at 21:25

1 Answer 1


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.

Given that you assume that your slope is stable and sufficiently well known, you can reduce the problem to a univariate setting, though. Namely, you can compute the residuals, in your example E = Y - X,and then monitor for level-shifts in E only.

For this you can also use the monitoring techniques from the structural change literature but also control charts (such as EWMA etc.) from the statistical process control literature. The main difference between these is that the techniques try to control different properties of the procedure: type-I errors (in monitoring) vs. average run length etc. (in process control).


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.