Reputation: 11
I have 2 time series data. I need to find the time lag between this 2 variables. the dates in these 2 data sets do not coincide with each other but they are over the same period of time. I wonder if this is possible. Anyone knows how? :)
Upvotes: 1
Views: 2926
Reputation: 6784
As Dieter Menne says, cross-correlation might help. For example
x <- c(1,2,1,9,1,3,2,1,3,2)
y <- c(7,9,8,7,9,8,1,7,9,8)
ccf(x, y)
produces
showing that the main effect happens 3 values earlier in x
than in y
and the relationship is negative. Real-life examples will typically not show such a single peak.
Upvotes: 1