I have $500$ observations and I want to make exponential weighted average of them.
I want the weights to be something like $w_i = 0.999^t$ when $t$ is from $1$ to $500$ (num of observations). Obviously $\sum_i w_i = 1$.
How can I generate those $w_i$?
Thanks,
Let $x_i = a^i$, then setting $w_i = \dfrac{x_i}{\sum_{i=1}^{500} x_i}$, we obtain what we want. We have $$\sum_{i=1}^{500} a^i = a \left(\dfrac{1-a^{500}}{1-a}\right)$$ Hence, we have $$w_i = \left(\dfrac{1-a}{1-a^{500}}\right)a^{i-1}$$