# Testing significance of correlation between time series [closed]

I would like to know if there are some methods (or better, some statistics or even better, some R functions) like in https://en.wikipedia.org/wiki/Pearson_correlation_coefficient#Inference or in the R function cor.test() which can be used to test the hypothesis $H_0: \text{corr}(X_t,Y_t)=0$ for 2 time series $(X_t)$ and $(Y_t)$ and especially for stationary time series (I'm aware of the spurious correlations one can have with non-stationary series, hence I know that we often need to take differences).

I already found many similar questions here but I feel like they only partially answer the question. Also, I feel quite lost between the approaches I know, like cointegration test, Granger causality test, pre-whitening and some papers I saw like this one or some other papers containing many complicated statistics like this one or this one and many others...

Finally, I would like to see answers giving a kind of survey of (some of) the possibilities we have, the tools we should/must use (in which case and/or in which order) and if possible, please indicate some R functions which would be helpful (of course, I know ccf() function).

I hope it's clear and I hope it's not too much demanding.

Edit: After thinking, I can ask the following questions:

1. How to test the significance of Pearson correlation between 2 stationary time series? This has been answered below by @taylor.

2. I have also the same question for Kendall correlation and for distance correlation. If possible (and if it exists), could you provide some R functions which perform these tests?

Last edit: Finally, I'll create a new question for this 2nd point, following the advice of @Juho Kokkala in his comment below.

• The second question would be better as a new question (especially if the first is already answered here). Note, however, that "Could you provide some R functions" is off-topic. Apr 26, 2018 at 4:36

Bartlett's theorem is useful for this. If $\{\mathbf{X}_{t}\}$ is a bivariate time series whose components are defined by $$X_{t1} = \sum_{k=-\infty}^{\infty} \alpha_k Z_{t-k,1}, \hspace{10mm} \{Z_{t1}\} \sim \text{IID}(0, \sigma^2_1)$$ and $$X_{t2} = \sum_{k=-\infty}^{\infty} \beta_k Z_{t-k,2}, \hspace{10mm} \{Z_{t2}\} \sim \text{IID}(0, \sigma^2_2)$$ where the two sequences $\{Z_{t1}\}$ and $\{Z_{t2}\}$ are independent, $\sum_k |\alpha_k| < \infty$, and $\sum_k |\beta_k| < \infty$, then for all integers $h,k$, $h \neq k$, $\sqrt{n}(\hat{\rho}_{12}(h), \hat{\rho}_{12}(k))'$ is asymptotically Normal, with mean equal to the zero vector and covariance matrix equal to $$\left[\begin{array}{cc} \sum_{j=-\infty}^{\infty} \rho_{11}(j)\rho_{22}(j) & \sum_{j=-\infty}^{\infty}\rho_{11}(j)\rho_{22}(j+k-h) \\ \sum_{j=-\infty}^{\infty}\rho_{11}(j+k-h)\rho_{22}(j) & \sum_{j=-\infty}^{\infty} \rho_{11}(j)\rho_{22}(j) \end{array}\right].$$

In particular $$\sqrt{n}\hat{\rho}_{12}(h) \overset{D}{\to} \text{N}\left(0, \sum_{j=-\infty}^{\infty} \rho_{11}(j)\rho_{22}(j) \right),$$ which means that you can still observe large cross-correlations for independent time series!

But, if you assume further that at least one of $X_{t1}$ and $X_{t,2}$ is white noise, then many of those summands are $0$ and $$\sqrt{n}\hat{\rho}_{12}(h) \overset{D}{\to} \text{N}\left(0, 1 \right).$$ This is why prewhitening is done, which may or may not be necessary. Apply whitening filter(s) to the data will not change whether or not the series are independent, but it will give you a better standard error for the sample correlation at different lags. Under this assumption, you can look at cross correlations (in R with acf or ccf) and see if they're larger than $\pm \frac{2}{\sqrt{n}}$ (assuming $n$ is large).

• Great answer, thank you. I only upvoted it since this corresponds to what I want only for Pearson correlation.
– paf
Apr 25, 2018 at 19:40
• @paf this deals with sample autocorrelations, which have a slightly different formula than Pearson correlations. Also, the setup for this test relies on different assumptions than the iid bivariate normal setup assumed for the Pearson test. We assume independence in space, not through time. If you reject the null of independence, and you still believe your data are stationary, I would look at VAR models (and then you can look at Granger Causality). Cointegration will not apply in your case. Apr 25, 2018 at 23:38
• "Independence in space, not through time." I agree, that's exactly what I wanted to test in my question.
– paf
Apr 26, 2018 at 19:06