Compute exponentially-weighted moving standard deviation
Description
Compute exponentially-weighted moving standard deviation
Usage
<Expr>$ewm_std(
...,
com,
span,
half_life,
alpha,
adjust = TRUE,
bias = FALSE,
min_periods = 1,
ignore_nulls = FALSE
)
Arguments
…
|
These dots are for future extensions and must be empty. |
com
|
Specify decay in terms of center of mass, *γ*, with
$\alpha = \frac{1}{1 + \gamma} \\ \forall \\ \gamma \geq 0$ . |
span
|
Specify decay in terms of span, *θ*, with
$\alpha = \frac{2}{\theta + 1} \\ \forall \\ \theta \geq 1$ |
half_life
|
Specify decay in terms of half-life, *λ*, with
|
alpha
|
Specify smoothing factor alpha directly, 0 \<
.
|
adjust
|
Divide by decaying adjustment factor in beginning periods to account for
imbalance in relative weightings:
|
bias
|
If FALSE (default), apply a correction to make the estimate
statistically unbiased.
|
min_periods
|
The number of values in the window that should be non-null before
computing a result. If NULL (default), it will be set equal
to window_size .
|
ignore_nulls
|
Ignore missing values when calculating weights.
|
Value
A polars expression
Examples
library("polars")
df <- pl$DataFrame(a = 1:3)
df$select(pl$col("a")$ewm_std(com = 1, ignore_nulls = FALSE))
#> shape: (3, 1)
#> ┌──────────┐
#> │ a │
#> │ --- │
#> │ f64 │
#> ╞══════════╡
#> │ 0.0 │
#> │ 0.707107 │
#> │ 0.963624 │
#> └──────────┘