CrossCorr | R Documentation |
CrossCorr
is the function for the cross-correlation or cross-covariance of two univariate series of observations using numerical vectors. The function is a Wrapper for the ccf
function with additional features.
Beware, CrossCorr
assumes implicitly that both time series have the same frequency and thus accepts simple numerical vectors.
CrossCorr(FirstTimeSeries, SecondTimeSeries,
nLags = 2,type = "correlation",PlotIt=FALSE,main,...)
FirstTimeSeries |
[1:n] vector or time series, see also input of |
SecondTimeSeries |
[1:n] vector or time series, see also input of |
nLags |
Positive scalar, the limit number of lags (in units of observations) to be inspected forward and backward in |
type |
Character string giving the type of acf to be computed. Allowed values are "correlation" (the default), "covariance" |
PlotIt |
Optional, if TRUE, output is plotted as a dashboard with values as bars against various lags, for the lag with highest cross correlation or covariance additionally the spearman rank correlation with a scatter plot is shown. Default is FALSE |
main |
Optional, title of plot. |
... |
Further arguments passed on to output of |
Procedure ist as follows: the timeseries is moved forward from FirstTimeSeries[t+1]
to FirstTimeSeries[t+nLags]
and backward from FirstTimeSeries[t-1]
to FirstTimeSeries[t-nLags]
and every lagged time series FirstTimeSeries
is compared to SecondTimeSeries
.
A cross correlation at lag nlag
means that the value nlag-time steps ahead of the FirstTimeSeries
correlates with the value of the current time step of the SecondTimeSeries
.
Covariance is a measure indicating the extent to which two random variables change in tandem. Correlation is a scalar measure that indicates how strongly two variables are statistically linearly related which does not mean that they are related by causality. For nLags
: back shifting: positiv values, forward shifting: negative values.
output of ccf
in invisible
mode
Covoriance is not normalized, Instead the normalization is in the multiplication of units of both time series.
Michael Thrun
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.