2.2.2.2 Cross Correlation (CCF)CCF
Summary
This CCF (Cross Correlation function) tool is supported in the Time Series Analysis App. It is used to compute and plot the cross correlations between two series.
Tutorial
This tutorial uses App’s built-in sample project. To open this sample OPJU file:
- Right click the Time Series Analysis App icon
in the Apps Gallery and choose Show Samples Folder.
- A folder will open. Drag-and-drop the project file TSA Sample.opju into Origin.
CCF
- Expand Project Explorer docked on the left. Select folder Statistics and Test . The Book5 contains data
about marketing spending and income .
- Highlight Column B and C, and then click the Time Series Analysis App icon
in the Apps Gallery.
- In the dialog, select Statistics and Test and CCF tool.
- Set Number of Lags to 10. Then click the OK button.
- Then you will get the report with CCF graph.
Algorithm
Cross correlation calculates the correlation between two time series with different lags. It can be used to identify lags of one time series so that it can be the predictor of the other time series.
This app calls nag_tsa_cross_corr (g13bcc) function [1] to calculate.
Given two time series xi, yi, i = 1, 2, ..., n, the cross correlations between xt and yt with lags can be calculated as:
![\begin{equation}r_k = \frac{\displaystyle\sum_{t=1}^{n-k} (x_t - \bar{x})(y_{t+k}-\bar{y})}{n s_x s_y}, \;k = 0,\, 1,\, ...,\, n_k \tag{1}\end{equation} \begin{equation}r_k = \frac{\displaystyle\sum_{t=1}^{n-k} (x_t - \bar{x})(y_{t+k}-\bar{y})}{n s_x s_y}, \;k = 0,\, 1,\, ...,\, n_k \tag{1}\end{equation}](//d2mvzyuse3lwjc.cloudfront.net/doc/en/App/images/CCF/math-5ebe04c8b1c8d05cf165f0d5ba5d5ebe.png?v=0)
where and are means of time series xi and yi, sx and sy are standard deviations of time series xi and yi,
![s_x^2 = \frac{(x_t - \bar{x})^2}{n} s_x^2 = \frac{(x_t - \bar{x})^2}{n}](//d2mvzyuse3lwjc.cloudfront.net/doc/en/App/images/CCF/math-8031038fd9e8c145c2561cc4edd0bb40.png?v=0)
and similarly for sy.
For lag k<0, it can be calculated by exchange time series xi and yi in Equation (1).
![n_k = \begin{cases}n - 1 \;&\text{if } n \leq 14\\10 + \sqrt{n} \;&\text{otherwise}\end{cases} n_k = \begin{cases}n - 1 \;&\text{if } n \leq 14\\10 + \sqrt{n} \;&\text{otherwise}\end{cases}](//d2mvzyuse3lwjc.cloudfront.net/doc/en/App/images/CCF/math-d2cb3149ce960f28fc44cd0206a395ef.png?v=0)
- Standard Error of Cross Correlation
![s_k = \frac{1}{\sqrt{n - |k|}} s_k = \frac{1}{\sqrt{n - |k|}}](//d2mvzyuse3lwjc.cloudfront.net/doc/en/App/images/CCF/math-324889542412ba0dd5acebaaf4d0637f.png?v=0)
Lower confidence limit at lag k:
![LCL_k = -2 s_k LCL_k = -2 s_k](//d2mvzyuse3lwjc.cloudfront.net/doc/en/App/images/CCF/math-d059e0417c0f7e24f8bd34a7a0e9bcf7.png?v=0)
Upper confidence limit at lag k:
![UCL_k = 2 s_k UCL_k = 2 s_k](//d2mvzyuse3lwjc.cloudfront.net/doc/en/App/images/CCF/math-5166b45dbf4cd76e274889a06d4bfdaf.png?v=0)
Reference
1. nag_tsa_cross_corr (g13bcc)
|