2
$\begingroup$

I have $n$ independent variables $x_i$ and dependent variables $y_i$ with uncertainties for both $x$ and $y$. I did a linear regression to get a model $\hat y = \beta x$.

Now I want to use this regression model to determine when the underlying system dynamics (a.k.a. $\beta$) changed. I calculate the residuals of new points to see their deviation from my model. I can plot the residuals and see that at one point the residuals increase a lot.

But what means a lot? I wanted to calculate a probability that this residual cannot be explained by the variance of the data. I am thinking this is the confidence that something in the system has changed.

My thought was that I can calculate standard deviation about the regression with $$ s_r = \sqrt{\frac{\sum (y_i - \hat y)}{n - 2}}, $$ and then use the probability for each point using the normal probability density function.

But this seems very naïve and assumes that my regression curve is the actual true relationship. I am not taking into account that if the new values are far away from my first ones, the model should naturally be bad. This led me towards the confidence and prediction bands, but I do not know how I can use this to get the probability that the new point does not fit.

Also, I am completely neglecting the known uncertainties of my input.

$\endgroup$
3
  • $\begingroup$ Welcome to Cross Validated! I wanted to calculate a probability that this residual cannot be explained by the variance of the data. I think you need to pin down what you mean by this before how to do that can be determined. Could you please clarify what you mean? $\endgroup$
    – Dave
    Commented May 29 at 15:18
  • $\begingroup$ You could do something like a Chow test (en.wikipedia.org/wiki/Chow_test) or variants of it, but this assumes that you know the break point. $\endgroup$
    – minginator
    Commented May 29 at 15:25
  • $\begingroup$ "Event studies" in finance sound similar. There are many tests that are used. $\endgroup$ Commented May 29 at 19:24

1 Answer 1

2
$\begingroup$

On the one hand, you can absolutely use prediction intervals (your software should be able to do this by itself) and check whether a data point falls outside some (say) 99% PI. Of course, this can happen by chance (in 1% of cases even in the best of all possible worlds), and any detection of this kind will need to accept some false positives. You can reduce this by looking at multiple consecutive points outside the PI. This is close to statistical process control, googling for that may be helpful.

Yes, to a degree this assumes you know the true data generating process. But usually, being "close enough" is good enough. And after all, you are looking for points where the DGP changes so much that your understanding of it degrades noticeably - one could argue that for this to hold, your original understanding does not need to have been perfect, just that it used to be a lot better than it is after the event.

On the other hand, you can also take your ordered stream of residuals (it sure sounds like you have a time series, so you might also want to look at forecasting), and run standard structural change detection algorithms on those. Again, this is a large field, because there are many different "changes in structure", from level shifts (which may be what you mainly have in mind) to changes in trend or variance. Again, google for the term. In R, the strucchange package comes to mind.

$\endgroup$
3
  • $\begingroup$ Thanks a lot! I did stumble upon prediction intervals before. Looking a bit more into it, this looks like exactly what I was looking for. Also thanks for your pointers to structural change detection, I'll look into that. $\endgroup$
    – Tibor
    Commented Jun 3 at 7:33
  • $\begingroup$ One question about the prediction intervals: How can I incorporate my input uncertainties in the prediction interval as well? Or do I not need to worry about the uncertainty as it is "included" in the variance (which is calculated in the PI)? $\endgroup$
    – Tibor
    Commented Jun 3 at 7:55
  • $\begingroup$ That is a very good question, which would merit a thread by itself here at CV. Perhaps you want to run a search in the prediction-interval tag, or ask a question. The standard PIs for OLS assume predictors measured without error, both historically and for the prediction period, so just using them will likely yield PIs that are too narrow. I personally would run simulations using "reasonable" assumptions on the uncertainties in predictors, and collect quantiles of simulated outcomes. But there may be a principled approach somewhere. $\endgroup$ Commented Jun 3 at 8:00

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.