Cross-covariance
Compute covariance at various lags (= correlation(x-mean(x), y-mean(y))).
xcov( x, y = NULL, maxlag = if (is.matrix(x)) nrow(x) - 1 else max(length(x), length(y)) - 1, scale = c("none", "biased", "unbiased", "coeff") )
x |
Input, numeric or complex vector or matrix. Must not be missing. |
y |
Input, numeric or complex vector data. If |
maxlag |
Integer scalar. Maximum covariance lag. If omitted, the
default value is |
scale |
Character string. Specifies the type of scaling applied to the covariation vector (or matrix). matched to one of:
,
where |
A list containing the following variables:
array of covariance estimates
vector of covariance lags [-maxlag:maxlag]
The array of covariance estimates has one of the following forms:
Cross-covariance estimate if X and Y are vectors.
Autocovariance estimate if is a vector and Y is omitted.
If x
is a matrix, C
is a matrix containing the
cross-covariance estimates of each column with every other column. Lag
varies with the first index so that C
has 2 * maxlag + 1
rows
and P^2 columns where P
is the number of columns in x
.
Paul Kienzle, pkienzle@users.sf.net.
Conversion to R by Geert van Boxtel, G.J.M.vanBoxtel@gmail.com.
x <- rnorm(1000) cl <- xcov(x, maxlag = 10, scale = 'coeff') plot (cl$lags, cl$C, type = "h", xlab = "", ylab = "") points (cl$lags, cl$C) abline(h = 0)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.