0
$\begingroup$

What options are there for finding out what the time lag is for different time series? I'm looking at market data here - for example, if sugar does bad in a year, it's likely that soda might be hit the next year. I've come across cross-correlation, but am not sure how to go about using it. Are there any libraries that perform fast cross-correlation if that is the only way to go?

$\endgroup$
2
  • $\begingroup$ For starters, look for a peak in the cross-correlation. If you could put a figure showing your cross-correlation, we could probably help you better. $\endgroup$
    – Memming
    Commented Jan 2, 2014 at 22:50
  • $\begingroup$ When you say that you're not sure how to use it, do you mean you can't see how to apply the concept, or do you mean you don't have or know how to use the appropriate software? $\endgroup$
    – Wayne
    Commented Mar 4, 2014 at 21:06

3 Answers 3

1
$\begingroup$

The cross-correlation between two time can be computed but is of little(none) value in assessing the time delay as statistical tests for the cross-correlation coefficients require normality (i.e. independence of successive observations ) and more. One can pre-whiten the "cause" series via an ARIMA model to create a surrogate x and then apply the ARMA coefficients to the Y variable (appropriately made stationary) to get a surrogate y. Proceed to get meaningful cross correlation coefficients which may suggest the time lag between the originally measured series (Y and X). This is referred to as Transfer Function Model Identification.

$\endgroup$
0
$\begingroup$

I don't know if there are other methods, but cross correlation is definitely a classic "go-to" technique that you should try first.

MATLAB has a library function to do cross correlation in their "signal processing toolbox", however, you will likely need to buy a license for both the basic MATLAB GUI, plus an additional license for the toolbox as well. It's possible that they may have a 30-day free trial option or something like that, if this is just a one-time project for you.

There is also GNU Octave, which is designed to be a freeware competitor to MATLAB. Although I've never used Octave personally and can't really recommend it one way or another, nevertheless, I do know that many of the core pieces of the MATLAB toolboxes often have identical counterparts in Octave, especially for really basic, bread-and-butter, textbook functions such as cross-correlation. As in MATLAB, the corresponding function that you would want in Octave is also called xcorr.

Python numpy/scipy also appears to have two functions that do this as well: numpy.correlate and scipy.signal.correlate. In principle, I think you should be able to use either one, although if you want to be really thorough, it would probably be wise to try both of them, and verify that they do indeed give you the same answer.

$\endgroup$
0
$\begingroup$

Look at cross spectral analysis, and particularly coherence. It is similar to cross-correlation, but you wanted to try something else :)

You can also analyze phase shifts, to find which signal is leading the other, get hints to causality etc.

$\endgroup$

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.