
Last chance! 50% off unlimited learning
Sale ends in
Computes running covariance between time-series x
and short-time pattern y
.
RunningCov(x, y, circular = FALSE)
A numeric vector.
A numeric vector, of equal or shorter length than x
.
Logical; whether running variance is computed assuming
circular nature of x
time-series (see Details).
A numeric vector.
Computes running covariance between time-series x
and short-time pattern y
.
The length of output vector equals the length of x
.
Parameter circular
determines whether x
time-series is assumed to have a circular nature.
Assume x
, y
.
If circular
equals TRUE
then
first element of the output vector corresponds to sample covariance between x[1:l_y]
and y
,
last element of the output vector corresponds to sample covariance between c(x[l_x], x[1:(l_y - 1)])
and y
.
If circular
equals FALSE
then
first element of the output vector corresponds to sample covariance between x[1:l_y]
and y
,
the x[(l_x - l_y + 1):l_x]
,
last W-1
elements of the output vector are filled with NA
.
See runstats.demo(func.name = "RunningCov")
for a detailed presentation.
# NOT RUN {
x <- sin(seq(0, 1, length.out = 1000) * 2 * pi * 6)
y <- x[1:100]
out1 <- RunningCov(x, y, circular = TRUE)
out2 <- RunningCov(x, y, circular = FALSE)
plot(out1, type = "l"); points(out2, col = "red")
# }
Run the code above in your browser using DataLab