Rolling Covariance¶
Computes the rolling sample covariance (ddof=1) between two numeric vectors.
Usage¶
rolling_cov(x, y, window_size, min_periods = window_size)
Parameters¶
Parameter |
Description |
|---|---|
|
A numeric vector of type double. |
|
A numeric vector of type double, same length as |
|
Positive integer window length. |
|
Minimum number of valid (non- |
Returns¶
A numeric vector with rolling covariance values.
Examples¶
x <- as.double(c(1, 2, 3, 4, 5))
y <- as.double(c(2, 4, 6, 8, 10))
rolling_cov(x, y, 3L)