Rolling Sample Variance¶
Computes the rolling sample variance over a numeric vector.
Usage¶
rolling_variance(x, window_size, min_periods = window_size, method = "stable")
Parameters¶
Parameter |
Description |
|---|---|
|
A numeric vector of type double. |
|
Positive integer window length. |
|
Minimum number of non- |
|
|
Returns¶
A numeric vector with rolling sample variance values. Entries are
NA when fewer than min_periods non-NA observations are
present in the window, and NaN when variance is undefined (fewer
than two values).
Examples¶
x <- as.double(c(1, 2, 3, 4))
rolling_variance(x, 3L)