I wrote a simple function in Python to calculate the exponentially weighted mean:
def test():
x = [1,2,3,4,5]
alpha = 0.98
s_old = x[0]
for i in range(1, len(x)):
s = alpha * x[i] + (1- alpha) * s_old
s_old = s
return s
However, how can I calculate the corresponding SD?