Open celsius38 opened 1 month ago
hi @celsius38
is there a reference for this function? is an adjust
parameter necessary, like it is in ewm_mean
?
@MarcoGorelli Couldn't find an existing implementation in any package but it is frequently used in quantitative trading, for example, impact models, etc.
The difference between ema and ems: ema will not change the mean for a stationary distribution, but ems will (and bigger for longer half-life)
I think it should be exactly the same as ema except for that when doing the update, you don't multiply the update by 'alpha'
thanks for your response
even without reference software is there any reference textbook / paper that includes the formula? If someone asks about it in the future, it would be good to have something to point to
I think it should be exactly the same as ema except for that when doing the update, you don't multiply the update by 'alpha'
for the unadjusted version, right? because there's two version for ewm_mean
right now: https://docs.pola.rs/api/python/stable/reference/series/api/polars.Series.ewm_mean.html
it looks like the formula you've provided is analogous to the ewm_mean unadjusted formula
Description
Also here: https://stackoverflow.com/questions/78741144/is-there-a-exponentially-weighted-moving-sum-ewms-instead-of-ewma-function-in
In polars ewm_mean, the update is formulated as:
I found that sometimes it is useful to use non-decayed update, a.k.a. exponentially weighted moving sum instead:
ewms is merely a simple multiple (1 / alpha) of ewma for equal time lapse but not so trivial when updates are not equally spaced
To achieve this I implement some update function on myself and try to use
.map_batches()
but think it's rather suboptimal.Is there a better alternative?