Skip to content

Rolling skew

Source code

Description

Compute the rolling (= moving) skewness over the values in this array. A window of length window_size will traverse the array.

Usage

<Expr>$rolling_skew(window_size, bias = TRUE)

Arguments

window_size Integer specifying the length of the window.
bias If FALSE, the calculations are corrected for statistical bias.

Details

For normally distributed data, the skewness should be about zero. For uni-modal continuous distributions, a skewness value greater than zero means that there is more weight in the right tail of the distribution.

Value

Expr

Examples

library(polars)

pl$DataFrame(a = c(1, 3, 2, 4, 5, 6))$
  with_columns(roll_skew = pl$col("a")$rolling_skew(window_size = 2))
#> shape: (6, 2)
#> ┌─────┬───────────┐
#> │ a   ┆ roll_skew │
#> │ --- ┆ ---       │
#> │ f64 ┆ f64       │
#> ╞═════╪═══════════╡
#> │ 1.0 ┆ null      │
#> │ 3.0 ┆ 0.0       │
#> │ 2.0 ┆ 0.0       │
#> │ 4.0 ┆ 0.0       │
#> │ 5.0 ┆ 0.0       │
#> │ 6.0 ┆ 0.0       │
#> └─────┴───────────┘