Exponentially-weighted moving variance
Description
Exponentially-weighted moving variance
Usage
<Expr>$ewm_var(
com = NULL,
span = NULL,
half_life = NULL,
alpha = NULL,
adjust = TRUE,
bias = FALSE,
min_periods = 1L,
ignore_nulls = TRUE
)
Arguments
com
|
Specify decay in terms of center of mass, *γ*, with
= ; ;
|
span
|
Specify decay in terms of span, *θ*, with $= ; ; $ |
half_life
|
Specify decay in terms of half-life,
:math: , with $ = 1 - { } $ $ ; \>
0$
|
alpha
|
Specify smoothing factor alpha directly, 0 \< *α* ≤ 1. |
adjust
|
Divide by decaying adjustment factor in beginning periods to account for
imbalance in relative weightings:
|
bias
|
If FALSE , the calculations are corrected for statistical
bias.
|
min_periods
|
Minimum number of observations in window required to have a value (otherwise result is null). |
ignore_nulls
|
Ignore missing values when calculating weights:
|
Value
Expr
Examples
#> shape: (3, 2)
#> ┌─────┬──────────┐
#> │ a ┆ ewm_var │
#> │ --- ┆ --- │
#> │ i32 ┆ f64 │
#> ╞═════╪══════════╡
#> │ 1 ┆ 0.0 │
#> │ 2 ┆ 0.5 │
#> │ 3 ┆ 0.928571 │
#> └─────┴──────────┘