0
$\begingroup$

This question already has an answer here:

I have two time series. I want to evaluate if two time series are different enough in one window or space of time. The objective is to trigger an alert when one time series divert significantly from the other. I attach one example where the blue line has a small bump that the red line doesn't. How can I statistically evaluate that this gap is high enough to consider that from 12:00 to 15:00 there has been a deviation?

This may seem as a duplicate for How to statistically compare two time series? but I don't want to compare the whole time-series sequence but rather segments or windows of it.

enter image description here

$\endgroup$

marked as duplicate by mkt, kjetil b halvorsen, Jan Kukacka, Firebug, Peter Flom Oct 17 '18 at 13:11

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

0
$\begingroup$

As long as the data doesn't look like it has sharp discontinuities (this portion you showed doesn't seem to), it looks like Kalman filtering would do the job fairly nicely. With a Kalman filter, you can get a smoother version of your data (the filter solution going through the instantaneous mean of your signal), and you can also estimate how much of the jitter at every time point is due to observation noise. You can use some heuristic rule that if the means of the 2 signals are farther than the sum of 3std. deviation of noise for each signal, you have diverged.

Do you need to do this in real-time, constantly updating the observation? It sounds like your observations happen infrequently enough that the time it takes to calculate a KF is negligible, but KF also has a nice feature that you can use it in forward mode as a filter and let it update itself with the newest observations. As long as you don't need to smooth it, which you calculate backward once you calculate the forward filter, a KF is very computationally efficient.

https://en.wikipedia.org/wiki/Kalman_filter

$\endgroup$

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