Calculates and plots the sample CCF of two time series.
ccf2(x, y, max.lag =NULL, main =NULL, ylab ="CCF", plot =TRUE, na.action = na.pass, type = c("correlation","covariance"),...)
Arguments
x, y: univariate time series
max.lag: maximum lag for which to calculate the CCF
main: plot title - if NULL, uses x and y names
ylab: vertical axis label; default is 'CCF'
plot: if TRUE (default) a graphic is produced and the values are returned invisibly. Otherwise, the values are returned.
na.action: how to handle missing values; default is na.pass
type: default is cross-correlation; an option is cross-covariance
...: additional arguments passed to tsplot
Details
This will produce a graphic of the sample corr[x(t+lag), y(t)] from -max.lag to max.lag. Also, the (rounded) values of the CCF are returned invisibly unless plot=FALSE. Similar details apply to the cross-covariance.
References
You can find demonstrations of astsa capabilities at FUN WITH ASTSA.