I am working with two time series and I am interested in understanding the relationship between them. As a first step, I checked the cross correlation function (using ccf()
in R).
The output of my code is shown below, where I'm running ccf(x,y)
. As I understand it, the conclusion here is that x
at time t+k
is negatively correlated with y
at time t
, where the lag, k = 2,3,4,5,6
.
I'm really surprised by this because my hypothesis was that x
would lead to negative changes in y
, and therefore I expected to see the negative correlation at negative values of the lag, k
. In fact, I can't think of how changes in y
might induce a change in x
at some point in the future, despite what I see here.
Is my interpretation of the output correct? I assume so after running some tests of the form:
x <- rnorm(10)
y <- -lead(x)
ccf(x, y, na.action=na.omit)
But given how surprised by the result I feel, I want to double check.
Assuming that my interpretation is correct, could there any other explanation for this almost sinusoidal shape I see in the results? (I'm thinking that perhaps there is some feature to my data that could artificially cause these shapes - I've no intuition around this!).
I've got multiple independent experiments featuring these time series and I see a sinusoidal pattern in a majority of them (although the 'sine wave' has a different amplitude and frequency from plot to plot).
I'd also love to hear of alternative approaches to quantifying the relationship between two time-series.
-lead(x)
is doing... $\endgroup$lead
was serving as it is not a base R function, nor which package it is coming from. $\endgroup$