# Econometrics Toolbox Cross Correlation, how to use?

5 views (last 30 days)
Birtan Derin on 11 May 2018
Answered: Hang Qian on 7 Jun 2018
Hello everyone,
I'm kind of a beginner with the statistics tools, and I don't know how to interpret the results from the crosscorr function from Econometrics toolbox. Basically I have variables x1, and x2, and I typed crosscorr(x1,x2), which gave me a chart. I am trying to understand which variable has a lag or a lead against the other variable.
Now, in the plot, let's say the correlation is highest at lag = 5. How do you interpret this result? Does that mean x1 lags behind x2, or vice versa. In addition, my time series is from newest to oldest, but crosscorr function assumes the most recent date is the last row. How would that make a difference to the results?

Hang Qian on 7 Jun 2018
Hi Mehmet,
If your time series is sorted from newest to oldest, the first thing that you may want to do is to revert the order of the series, like
Z = Y(end:-1:1)
All functions in the Econometrics Toolbox assumes that the data are organized from oldest to newest, with the last observation being the most recent one.
Regarding interpretation of the crosscorr results, when the correlation is highest at lag = 5, I think the second series has a lead? You may want to see the definition of cross correlation, which is shown at the bottom of the documentation page under the section “ More about - Cross-Correlation Function”.
Best
Hang Qian

R2016b

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!