# How do I know quantitatively if the correlation of two time series is significant?

I computed the correlation coefficient of two time series of daily observations, x and y, but noticed that the more sampling points I used in the calculation, the lower the value of the correlation coefficient, until it reaches saturation at very long time.

It looks that the correlation coefficient is related to the number of points and it's unable to set a fixed threshold to the correlation coefficient. So, how can I know quantitatively if the correlation is significant?

• Some questions: How were you calculating the coefficient? When you say saturate, does it approach zero or some non-zero value? How many points were you using? You have to realize that correlation in the sense of probability is the likelihood that two different data points codeviate from their means. That is, if random variable X has deviated from its mean, how much do we expect Y to have also deviated? The larger your data set, the more true your correlation coefficient will be. If your coefficient converges to zero, that suggests they're uncorrelated – Izzo Dec 9 '16 at 23:31
• @Teague , the Pearson's correlation coefficient is computed. The real data constitute 300 to 500 points, from independent measures. I made some synthetic data and compute the correlations by randomly choosing N points from two time series. If N<100 to 150, the correlation coefficient value is very scattered, from 0.1 to 0.8. If N > 200 to 300, the value looks stably decreasing with increasing N, from around 0.5 until some lower limit between 0.1 and 0.2 for N>1500 to 2000. – ddzzbbwwmm Dec 10 '16 at 2:28
• I ever read a paper. The author got a correlation of about 0.2, not very high. But he proposed that considering the degree of freedom is larger than 300 (there are more than 300 points), a value much beyond 1/300 can be deemed to be significant. I don't know if this assertion is correct. – ddzzbbwwmm Dec 10 '16 at 2:34
• It may help to stack correlations within the period of interest. – n1nj4 Jan 12 '17 at 21:47
• @n1nj4 we don't have lots of pairs of time series to do what you suggested – ddzzbbwwmm Jan 16 '17 at 7:48

I believe you are looking for the normalized cross-correlation coefficient (source), which in your case would be computed as follows. First, you de-mean your time series $x(t)$ and $y(t)$ such that

$f(t) = x(t) - \bar{x}$, and $g(t) = y(t) - \bar{y}$

You can treat your time series as vectors $\mathbf{f}$ and $\mathbf{g}$. Assuming the vectors are of equal length, the formula for the normalized correlation coefficient is:

$R_{\text norm} = \frac{\mathbf{f}^T \mathbf{g}}{\| \mathbf{f} \| \| \mathbf{g} \|}$

This is bound to have a maximum value of $1$ (meaning the time series are very correlated), as you are essentially multiplying together two unit vectors.

However, note that if you have different length input vectors, then you should not scale the output.

There is a document from the cryptographic community called NIST Special Publication 800-90B, Recommendation for the Entropy Sources Used for Random Bit Generation, which is available here. Look to §5 and §6 and just come with me for a bit ☺...

90B has a test to determine whether a sequence is IID or not. By definition if a sequence is non-IID, it's correlated. Correlation is proven by certain tests that include compression. I'm unimpressed by NIST's implementation, so I have my own take on it.

There are compressors out there (like CMIX) that can compress data to within 0.1% of it's theoretical Shannon entropy. Entropy ($$H$$) is measured in bytes. So my test would work like this:-

1. Compress sequence $$x$$, giving $$H_x$$.

2. Compress sequence $$y$$, giving $$H_y$$.

3. Interleave the values from both sequences as $$\left[x_i, y_i, x_{i+1}, y_{i+1},x_{i+2}, y_{i+2}...\right]$$.

4. Compress the new interleaved sequence, giving $$H_{x|y}$$.

I posit that the correlation between $$x$$ and $$y$$ is related to:-

$$\frac{H_x + H_y}{H_{x|y}} -1$$

with 0 as no correlation at all, and 1 if $$x=y$$. It works because correlation is a form of redundancy. As correlation and thus redundancy increase, and $$y \rightarrow x$$, the compression algorithm finds it easier and easier to encode the $$x|y$$ sequence.

Examples:-

1. Two totally IID sequences have absolutely no relationship between them. No matter how they're interleaved, at whatever lag, $$H_{x|y} = H_x + H_y$$. Test value = 0, no correlation.

2. Two sequences where $$y = f(x)$$ and $$f$$ is the relationship/correlation between them. Imagine if $$y = \frac{x}{n}$$ and $$n$$ is some constant suggesting a strict correlation within the data. This tight relationship will be detected by the compression algorithm simply using a broader window. Rather than using an alphabet based on a single value, it will create a slightly bigger alphabet based on two sequential values $$\therefore H_{x|y} \approx H_x$$. Test value $$\approx$$ 1, full correlation.

I can't prove it any further, I just invented it. It seems to kinda work though, at least in simple cases.

• Could you explain why "the correlation between x and y is related to ..." – ddzzbbwwmm Nov 15 '18 at 18:04

p-value and t-test look to be solutions.

There is no other answer up to now. I keep this simple answer and shall remove if we have other good ones.