# How can I estimate the delay between two non-periodic time series?

I'm wondering what the best way to estimate the delay and confidence between two non-periodic time series would be.

Specifically, I thought it would be interesting to look at the different economic indicators, say the price of oil and a stock price, and determine whether one predicts the other, with how much confidence and by how far in advance.

Most of the answers I've been able to find so far have described periodic time series and phase difference in radians. It is not clear to me how this type of analysis would convert to non-periodic data and difference in time instead of angle. It may be possible to glean some information from treating the data as periodic, so that's not completely out.

Thanks!

The most straightforward approach is probably cross-correlation. You may be interested in the answers to this post and the posts linked in the right-hand-side of that post (linked also in my comment to one of the answers).

Another approach is by means of a dynamic regression. You could fit an autoregressive distributed lag model. For a description of this model and some references see for example my answer to this post.

This will allow you to test for the significance of one variable to explain the other and also for the significance of lags of the explanatory variable. The order of the highest significant lag will be a measure of the delay between both variables.

For the kind of data that you mention (economic indicators), you will probably need to fit the model for the differences or growth rates of the variables (not for the original series) in order for them to be stationary and avoid possible spurious results due to stochastic trends in the variables.

A more involved approach would be as follows:

1. Extract a cyclical signal from each series, for example by means of the Hodrick and Prescott filter or model based approaches (ARIMA, structural time series models).
2. Identify the peaks and troughs in the estimated cyclical signals. These points can generally be easily identified from the graph and can be detected manually, but if you have many time series it is relatively easy to devise an algorithm to do that.
3. Inspect the dates of the peaks and troughs in each series and compare them. Descriptive statistics of the difference between each peak or trough as well as an histogram of this differences can be helpful to determine whether a given series systematically reaches a peak some periods in advance or with delay compared to other series.

A nice way to look at the estimated cycles is the animated plot used by Statistics Netherlands to track the business cycle. This plot does not reveal exactly by how many periods an economic indicator is ahead or behind other indicators, but it's a nice way to summarize the results.

• Thanks for your very thorough response! I will dig into each idea mentioned. – Toby Manders Apr 20 '15 at 22:48

I suggest that you could simply use a prediction task not importantly how many lags one time-series is ahead of the other one; specially this makes sense while not necessarily always the difference of lags would continue the same during the history of two time-series; In the other hand, a prediction method can model it better. So, you have two features and a response variable as following:

x1 = history of price of oil till time t x2 = history of stock price till time t-1 y = price of stock price till time t(the one you think comes 'next after' the other)

Now using whatever prediction method (linear regression, SVR, SARIMA, ANN, ...) you train your model like this: model.train = (y(1:t) ~ x1(1:t) + x2(0:t-1) ) and you predict your response variable at each moment as: model.predict ( x1(t+1) + x2(t) ) which returns you the y(t+1) which is the price of stock price in the next time-slot.

Good luck!