Cross-correlation: does one time series lead the other?
In brief
In the card "How does a value develop over time?" the second series is under "More options". Statable then shows the cross-correlation: the correlation of the two series when shifted by k steps. The axis names the direction with the column names: on the left the second series leads, on the right the first one. Both series must have the same points in time, at least 10 places, must not be constant and may have at most 10% gaps.
The direction
Statable defines r(k) as the correlation of the first series at time t with the second series at time t + k. Positive k means: the first series leads, the second follows k steps later. R (ccf) counts the lag with the opposite sign: when comparing numbers from R, flip the sign of k. Checked with the case y(t) = x(t − 2): the maximum is at k = +2 in Statable and at −2 in R.
Trap: autocorrelation causes false alarms
The limits ±1.96/√n apply to each lag separately and assume that the series are white noise by themselves. If a series depends strongly on its own past, the bars exceed far too often. Measured (independent AR(1) series with φ = 0.8, n = 100, lags −10 to 10, 4000 runs): share of bars outside the limits raw 0.329 (should be 0.05), after first differences 0.050. At least one bar outside: raw 0.884, after differences 0.647, for white noise 0.628 (with 21 bars "at least one" is common even by chance). Statable shows a note when |r₁| > 0.5 in one of the series and offers "changes instead of values" (assistant "Shift and smooth"). Statable does not prewhiten.
Example
Monthly deaths from lung diseases, men and women (72 months): at lag 0 r = .98; both series depend strongly on their past (r₁ = .76 and .73). The high values at ±12 (r = .71 and .72) show the season. After the seasonal difference (lag 12, n = 60) r(0) = .90 remains.
Gaps
If single values are missing, Statable calculates like R with na.pass: sum of the pairs without a gap divided by (number of pairs + |k|); mean and variance without the gaps. That is an approximation and is called so in the sentence. Above 10% gaps nothing is calculated.
Sources
IBM SPSS Statistics Knowledge Center, version 23: CCF (cross-correlation function).