Professional Documents
Culture Documents
Leading indicator TS
Cross-correlation
Cross-correlation
Cross-correlation
CCF in R
Example in R
Example in R
Example in R
> ccf(hydro1, hydro2)
Example in R
> ccfvalues<-ccf(hydro1, hydro2)
> ccfvalues
-14
-13
-12
-11
-10
-9
-8
-7
-0.008 0.089 0.177 0.037 0.226 -0.022 0.094 -0.069
-5
-4
-3
-2
-1
0
1
2
-0.106 -0.016 0.069 0.071 0.271 0.341 0.770 0.297
4
5
6
7
8
9
10
11
-0.038 0.046 -0.136 -0.025 -0.058 -0.043 -0.106 0.044
13
14
15
-0.067 0.014 -0.044
When one or more xt+h (hydro1) are predictors yt (hydro2) and h is positive x lags y
Whats next?
If we know 1 variable leads another at a certain lag, can try to predict x using the lagged
observation of y using regression
= +1
2 = 1+1
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept)
10.90883
11.95623
0.912
0.364
hydroreg$hydro1 0.44684
0.04193 10.657
<2e-16 ***
--Signif. codes: 0 *** 0.001 ** 0.01 * 0.05 . 0.1 1
Residual standard error: 41.04 on 75 degrees of freedom
Multiple R-squared: 0.6023,
Adjusted R-squared: 0.597
F-statistic: 113.6 on 1 and 75 DF, p-value: < 2.2e-16
Just a check
> acf(hreg$resid)