EMA = Current_year*2/(3+1) + Last_yearEMA*(1 − 2/(3+1))
EMA = Current_year*0.5 + Last_yearEMA*0.5
And EMA calculation for 2 years be (your google sheet formula):
EMA = Current_year*2/(2+1) + Last_yearEMA*(1 − 2/(2+1))
EMA = Current_year*0.66 + Last_yearEMA*0.33
However, in the google formula you weighted the previous year by 0.66 and the current year by 0.33, meaning that you gave the most recent data less weightings and the EMA is actually 2 years instead of 3?
Thanks for pointing this out. I didn’t know there was a way to calculate the exponentially moving average (EMA) using NumPy.
Previously I was using alpha = 0.33 for weighting the current value. When that value is plugged into the formula alpha = 2 / N + 1, it means I was averaging over the past 5 years.
I’ve now decided to average over the past 4 years so the new alpha value is 0.4.
Shouldn’t the EMA calculation for 3 years be:
EMA = Current_year*2/(3+1) + Last_yearEMA*(1 − 2/(3+1))
EMA = Current_year*0.5 + Last_yearEMA*0.5
And EMA calculation for 2 years be (your google sheet formula):
EMA = Current_year*2/(2+1) + Last_yearEMA*(1 − 2/(2+1))
EMA = Current_year*0.66 + Last_yearEMA*0.33
However, in the google formula you weighted the previous year by 0.66 and the current year by 0.33, meaning that you gave the most recent data less weightings and the EMA is actually 2 years instead of 3?
https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.ewm.html
https://www.investopedia.com/terms/e/ema.asp
A slight change to use a 3 year-smoothing of a 3 year EMA
EMA(3 years) = Fund(t)*0.571+EMA(t-1)*0.286 + EMA(t-2)*0.143
*0.571+0.286+0.143 = ~ 1
I.e. 3 years EMA should actually be:
Thanks for pointing this out. I didn’t know there was a way to calculate the exponentially moving average (EMA) using NumPy.
Previously I was using alpha = 0.33 for weighting the current value. When that value is plugged into the formula alpha = 2 / N + 1, it means I was averaging over the past 5 years.
I’ve now decided to average over the past 4 years so the new alpha value is 0.4.