I have a group of time series variables and I want to found out the relationship among them. The method I use is to calculate pair-wise correlation between two time series and found out those with high correlation values and statistical significance (P<0.05 && Q <0.05).

However, When I checked literature, there were some papers mention that if the time series have auto-correlation themselves, the P value of the cross-correlation would be unstable and the correlation coefficient would be inflation and I have validate the inflation in my data set by using ARIMA module to detrend and calculate the cross-correlation between residues.

My question is, as my aim is to find out those have strong correlation time series pairs, the series have the same trend actually are those pairs I want to find, should I do the cross-correlation after detrending? I am afraid that some time series have the same trend could be detected by the correlation analysis however can not be detected after detrending.


3 Answers 3


Trend can mess up your correlation matrix for sure. For instance, here's the code in MATLAB that demonstrates it.

ans =

    1.0000    0.1099
    0.1099    1.0000



ans =

    1.0000    0.9991
    0.9991    1.0000


enter image description here

All I did was to generate random noise with or without deterministic trend.

This effect is even more evident on crosscorrelation plots for these two cases:

>> subplot(2,1,1)
>> crosscorr(x(:,1),x(:,2))
>> subplot(2,1,2)
>> crosscorr(y(:,1),y(:,2))

enter image description here

Depending on your situation you might be interested in the trend or the noise. If you're interested in the noise, then the correlation matrix in the second case is meaningless, it's a spurious correlation. In this case differencing will help as shown below:

>> corr(diff(x))

ans =

    1.0000    0.0479
    0.0479    1.0000

You see how we got back the reasonable correlation, no correlation in this case. Differencing doesn't work in every case, of course.


Not necessarily detrend but prewhiten. Autocorrelation can mask or inflate relationships between x and y series. And it is important to notice that prewhitening for both x and y must be done via model developed for the series x. Suppose that x can represented by an ARMA(1,0,0)(0,1,0) model. Then y is prewhitened/filtered via this model and CCF analysis is done between residual series of x and filtered series of y.

  • 1
    $\begingroup$ Sound advice except for the fact that the differencing operators may be different for y and x and the filter that gets applied (in your case) would be (1,0,0)(0,0,0). $\endgroup$
    – IrishStat
    Jun 30, 2015 at 10:37

I had the same question as you on the need to perform detrending. What I've found is that a time-dependent trend implies the expected value of the signal under study is non-stationary. Stationarity is a fundamental assumption for most of the data analysis algorithms such as cross-correlation we use. Here is a good link on the subject "Classic Time Series Analysis"1


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.