[R] how to optimise cross-correlation plot to study time lag between time-series?
Spencer Graves
spencer.graves at pdf.com
Mon Nov 7 02:24:04 CET 2005
If one series is "input" and the other "output", the traditional
advice (Box and Jenkins 1970 Time Series Analysis, Forecasting and
Control, sec. 11.2.1) is as follows:
1. Fit an ARIMA model to the "input".
2. Prewhiten the "output" series using the model for the "input".
Then compute the cross correlation function between the residuals from
the input and the prewhitened output.
This could, of course, be done in R, but I don't know if it has
already been programmed as a standard function.
RSiteSearch("pre-whitening") and RSiteSearch("prewhitening") produced 5
hits between them, and my cursory review of them didn't lead to
immediate enlightenment. If such a function exists, it's available
under a different name. There may be better techniques available today,
but I'm not familiar with them.
spencer graves
Jan Verbesselt wrote:
> Dear R-help,
>
> How could a cross-correlation plot be optimized such that the relationship
> between seasonal time-series can be studied?
>
> We are working with strong seasonal time-series and derived a
> cross-correlation plot to study the relationship between time-series. The
> seasonal variation however strongly influences the cross-correlation plot
> and the plot seems to be rather symmetrical (max cross-correlation
> coefficient occurs at lag 0). We would like to visualize the deviation from
> the symmetrical shape such that the relationship between these two time
> series can be studied. How can the symmetry be investigated by using a
> cross-corr. plot (ccf())?
>
> We tried the following:
>
> cross <- ccf(TS1, int.TS2, main= "")
>
> # produce the standard shape by correlating TS1 with TS1
> test <- ccf(TS1, TS1)
>
> # add the standard shape on the cross-correlation plot of TS1 with TS2
>
> plot(cross)
> par(new = T)
> plot(test$lag, test$acf, axes=F, xlab="", ylab="", col=2)
>
>
> Is there another technique to visualize the difference from the symmetrical
> shape? Is ts1 lagged vs. ts2?
>
> Jan
> (*Version R 2.2)
>
>
> Ps. -We tried also ccf() after differencing and decompositioning but
> seasonality remains in the residuals.
> -max cross-correlation mostly occurs at lag 0.
>
>
> _______________________________________________________________________
> Ir. Jan Verbesselt
> Research Associate
> Biosystems Department ~ M³-BIORES
> Vital Decosterstraat 102, 3000 Leuven, Belgium
> Tel: +32-16-329750 Fax: +32-16-329760
> http://gloveg.kuleuven.ac.be/
> _______________________________________________________________________
>
>
>
> Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
--
Spencer Graves, PhD
Senior Development Engineer
PDF Solutions, Inc.
333 West San Carlos Street Suite 700
San Jose, CA 95110, USA
spencer.graves at pdf.com
www.pdf.com <http://www.pdf.com>
Tel: 408-938-4420
Fax: 408-280-7915
More information about the R-help
mailing list