0

This recreates ewm(adjust=True).std(): pandas ewm var and std, but I have no luck replicating the calculations in ewm(adjust=False).std(). Replicating ewm(False).mean() is easy but how is the bias corrected when the calculation for variance is recursive? From pandas ewm.std calculation, the right formula seems to be:

var = (1-alpha) * (var_t-1 + bias * alpha * (y-ema_t-1)**2)

where bias=(2-alpha)/(1-alpha)/2. But how does it initialize, as the first values don't match up?

2
  • ewm(False).mean() - You mean ewm(adjust=False).mean(), right? Positional arg 1 is com, which is type float. Commented Aug 31 at 12:52
  • Often with rolling windows or lags and leads, datafram.dropna() is used to remove rows such as the first n rows because functions such as ewm leave those rows as NaN. It is a tricky territory Commented Oct 2 at 4:31

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.