I am analyzing two time series, and when I used the ccf function, I received this output:

enter image description here

I am pretty confused. I do not have too much experience with time series, but this looks weird to me. What exactly am I looking for in this plot? What does this tell me, and is this normal?

Thanks in advance!


1 Answer 1


The cross correlation function (ccf) is used to visually explore the correlation between two time series. But compared to a simple scatterplot which would only show the contemporaneous relationship between the two series, ccf shows how the relationship is distributed over time. More specifically, a spike at lag k shows the correlation between xx[t+k] and yy[t]. Obviously, if k=0 you are measuring the contemporaneous correlation, that is the linear relationship between xx[t] and yy[t]. However, the real value of ccf is that there are multiple spikes, each telling you something about how past or present of one series relates to the past or present of the other series. A negative spike at lag k (k>0), for example, means that the present value of yy series (present meaning at time [t]) is correlated with the future value of the yy series at time [t+k]. Similarly, a negative spike at lag k (k<0) means that the historic value of series xx at time [t+k] (historic because k<0 and that makes t+k less than the present time t) is correlated with the present value of yy at time [t].

Now, regarding the ccf that you provided. Clearly the cross correlations are not much different across the lags as all the spikes extend down to about -0.2. It has been shown that uninformative or misleading ccfs can result when the xx series is autocorrelated. One remedy to that is to "prewhiten" xx prior to cross-correlating with yy. Prewhitening is the process of removing autocorrelation from input and output time series (i.e. xx and yy) prior to cross-correlating them.

Below are the steps that need to be carried out for prewhitening and determination of the dynamic relationship between the series. A friendly introduction to this can be found in Bisgaard, S., & Kulahci, M. (2006). Quality Quandaries: Studying input-output relationships, part I. Quality Engineering, 18(2), 273-281.


  • $\begingroup$ Thanks for you answer! When I extend the lags to the amount of data points (2906), I definitely see something that looks more normal. But it seems very strange for the lag axis to go up to almost 3000. $\endgroup$ Commented Jul 24, 2019 at 2:44
  • $\begingroup$ You are welcome. You could be seeing more variation in the heights of spikes when you extend the horizontal axis, but I would still be careful with the interpretation of that ccf. Again, if your xx variable is autocorrelated (which you can check visually using an autocorrelation function (ACF)) then the ccf is going to be potentially misleading no matter how long you "stretch" the horizontal axis. $\endgroup$ Commented Jul 24, 2019 at 15:29

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.