# Similarity between time series signals

Lets say I have 2 time series that look like this for a number of different test subjects:

The lines represent values on 2 different metrics recorded at different points in time (minutes)

I have a prediction that says when the blue signal is high, the green will be low, and vice versa (i.e. they are inversely related). You can see this prediction play out between time points 1-7

I'm looking for a way to quantify the level of similarity (or I guess dissimilarity in this case) between the two signals, maybe some inferential test, to suggest that my prediction/hypothesis is correct. Are there any techniques designed for this type of analysis?

I've seen a few posts on here suggesting the use of a cross-correlation (e.g. Correlation between two time series), however, I dont think that would be useful in this case. A cross-correlation will tell me the maximum degree of similarity, and also the lag at which that similarity occurs. But I'm not really interested in similarity after time shifting because I only care about similarity as the data is recorded (lag 0)

I've tried a regular pearson correlation, but its resulting in really small correlation values. Are there any other methods that can help me determine whether my hypothesis is correct?

• In Econometrics, cointegration analysis is often used for such analysis. Please check quora.com/… to see if it helps in this case. May 16, 2017 at 8:32
• Thanks for that. From what I understand about cointegration analysis, it requires (or I guess assumes) that the 2 signals are cointegrated such that the distance between them at each time point is roughly similar? In my case that will rarely happen, especially given I'm expecting them to be negatively related - as one goes up, the other should go down, so at some point they will cross May 19, 2017 at 5:03
• Sample cross correlations can have surprising sampling distributions, even under the null of no cross correlation: stats.stackexchange.com/questions/342335/… Jan 30, 2019 at 4:17

First considering for a single subject. If we take each of the time points as independent, we should be able to state the hypothesis that for the equation $$y = \beta_1 + \beta_2x$$ $H_0: \beta_2 = 0$
$H_1: \beta_2 < 0$

Fitting an equation to find our estimate for $\beta_2$ and the standard error in our estimate $se(\beta_2)$ we can find the $t$ statistic from $$t = \frac{\beta_2}{se(\beta_2)}$$ The $t$ statistic can then be compared to tables of $t$ statistics.

For the case with many different subjects, it could depend on whether we need to take factors to do with the subjects out of the the problem, or whether we can bundle all of the data points into the model above.

Extensive reference here http://www.uv.es/uriel/4%20Hypothesis%20testing%20in%20the%20multiple%20regression%20model.pdf from page 5 onwards.

I hope I have understood the question correctly.

• If I understand this correctly this is just a regression model predicting one time series from the other, and then t-testing the coefficient? As I mentioned, I did try a correlation type approach, but I'm not sure how much I trust the technique here as my beta values were really small and around 0.004. So I thought maybe a correlation/regression type approach may not be appropriate for this? May 16, 2017 at 18:29
• I took from this "I have a prediction that says when the blue signal is high, the green will be low, and vice versa (i.e. they are inversely related)" that a regression model predicting one from the other would be the right way to go to test your hypothesis. Could each time in the time series be considered independent from the previous? If this isn't the case then the model I suggested may not be suitable. May 17, 2017 at 12:45
• hmm thats difficult to answer. one signal might be measuring walking speed at 10 consecutive minutes, so in that case you could say theyre not independent because the more someone walks the more tired they'll get. May 17, 2017 at 16:18

the simple cross-correlation doesn't make sense for two reasons 1) auto-correlation and 2) embedded/latent pulses/level shifts/seasonal pulses /local time trends thus it is possible to compute a robust cross-correlation using data adjusted for the embedded structure.
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 1, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.7729719281196594, "perplexity": 517.2473696127644}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2022-27/segments/1656104628307.87/warc/CC-MAIN-20220705205356-20220705235356-00064.warc.gz"}