http://mathbabe.org/2011/07/30/historical-volatility-on-the-sp-index/

(where the comments are closed)

Is that code absolutely correct? I was wondering about a line in the function get_vol(d):

var = (1-1.0/lam)*var + (1.0/lam)*r**2

shouldn’t it be:

var = (1-1.0/d)*var + (1.0/lam)*r**2

so that we can follow the formula

$V_{new} = s \cdot V_{old} + (1-s) \cdot r_0^2$

ie, shouldn’t lam be d in (1-1.0/lam)?

If I understood correctly, lam is just the sum of decays for a given number of returns being used in the volatility calculation, thats why we divide the new return by lam. But the old var should be multiplied by s, which is 1-1.0/d, right? So why isn’t it, or am I making a mistake??

Would appreciate help, though I can see this is an old post!

]]>http://www.vox.com/2014/6/16/5804590/why-you-shouldnt-drive-slowly-in-the-left-lane

]]>