6
$\begingroup$

I've got 3 univariate timeseries T1, T2, T3 individually analysed and anomaly detected. What I'm looking for is a correlated analysis where I should be able to correlate the anomalies across the time series.

Is this possible? If yes, any pointers? I was reading about a simple analysis of overlapping points on T1, T2, T3. But this seems to be naive and not reliable as the anomalies may not occur at the same time window.

How is this generally solved?

$\endgroup$

3 Answers 3

2
$\begingroup$

If you are happy with a method using Python then Linkedin's Luminol library may help you here. You can run the 3 time series through that it and it will cross correlate them. It has a anomaly detector element too, however the cross correlation method is pretty straight forward, based on Paul Bourke 1996 method and you can just use the correlator method as shown in the example below, without having to use any of the anomaly detector fucntionality.

https://github.com/linkedin/luminol

# Python example
# where anomaly_ts_dict and correlate_ts_dict are a Python dictionary of timestamp, value e.g.
# {1533831338: 5.6, 1533831368: 7.0}
# Let us sat T1 is the time series you are wanting to check T2 and T3 against

anomaly_ts_dict = dict(T1)  # T1 would have to be a dictionary
correlate_ts_dict = dict(T2)
label = 'T2'

# handle 120 second window on either side
time_period = (int(anomaly_timestamp - 120), int(anomaly_timestamp + 120))
my_correlator = Correlator(anomaly_ts_dict, correlate_ts_dict, time_period)
cross_correlation_threshold = 0.9

correlations = []
if my_correlator.is_correlated(threshold=cross_correlation_threshold):
  correlation = my_correlator.get_correlation_result()
  correlated = True
  correlations.append([label, correlation.coefficient, correlation.shift, correlation.shifted_coefficient])
$\endgroup$
0
$\begingroup$

What you are basically looking for is how the time series are behaving taken as a group. Am I right in that. In that case what you can do is consider the time series and then the simplest method would be to find the tick by tick mean and then a standard deviation of the entire matrix for all the three time series at all ticks. Now you can define the outliers as any point which lies outside the mean (plus-minus) standard deviation. However, if you want a more robust approach as mean is highly susceptible to outliers what you can instead do is go for the median in place of mean and MAD in place of standard deviation. Although, you would have to multiply your MAD by a normalizing parameter to make it a consistent estimator. MAD by the way is median absolute deviation.

$\endgroup$
1
  • $\begingroup$ What would your recommendation be if they were time series which are slightly shifted? like a sine-wave that starts at 0, 1, 1.5 (Just giving an example) $\endgroup$ Commented Jun 23, 2020 at 5:52
0
$\begingroup$

Do you need to quantitatively (and precisely) calculate correlation, or do you just want a way to be able to visualize? I use an "Outlier Heat Map" to identify across many time series the concentration of outliers by week of the year. I can see a) Any week of year that has a higher concentration of outliers across years (a column that is darker blue) and/or b) Identify any one week that has more outliers.

outlier heat map

Not sure the image is rendering correctly: https://github.com/chrisumphlett/Shared/blob/master/stackexchange/DATAMGMT_OutlierMap.png

$\endgroup$

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.