Skip to main content
14 events
when toggle format what by license comment
Jan 20, 2012 at 13:06 comment added Jason S OK, fair enough. I won't downvote.
Jan 20, 2012 at 6:50 history edited Jason R CC BY-SA 3.0
noted numeric instability of this method in floating point
Jan 20, 2012 at 6:45 comment added Jason R @JasonS: I would disagree that the technique is inherently flawed, although I agree with your point that it is not a numerically robust method when implemented in floating point. I should have been more clear that I've used this successfully in an application that used integer arithmetic. Integer (or fixed-point implementations of fractional numbers) arithmetic doesn't suffer from the issue you pointed out that causes loss of precision. In that context, it is a suitable method that requires fewer operations per sample.
Jan 20, 2012 at 6:43 comment added Jason R @Dilip: Thanks for noticing that; I've replaced $\tilde\mu$ with $\tilde\mu^2$.
Jan 20, 2012 at 6:43 history edited Jason R CC BY-SA 3.0
fixed missing exponents in standard deviation estimate
Jan 20, 2012 at 6:42 comment added Jason R Thanks for dusting off this old answer that obviously needs some attention.
Jan 20, 2012 at 4:43 comment added schnarf This is a really good answer, even though there are numerical problems when using floating-point. This is a problem with running sums in general. Floating-point rounding errors accumulate, and it will become unstable. One solution is to recalculate the sum every so often. Another is to stabilize the filter: a running sum is a filter with poles on the unit circle, and shifting the poles in just a little bit, say, so their radius is 0.999 will make the filter more stable. Another solution is to use integers instead of floats.
Jan 20, 2012 at 1:33 comment added Dilip Sarwate There seem to be a couple of typos here. Why is the mean being subtracted under the square root sign for $\sigma$? it should be $\mu^2$ to match the displayed equation $\sigma^2 = E(X^2) - (E(X))^2$, no? Also, though I won't vote down this answer, I agree with Jason S that there can be numerical problems in this approach.
Jan 20, 2012 at 0:23 comment added Jason S -1 when I have enough rep to do so: this has numerical problems. See Knuth vol. 2
Dec 7, 2011 at 2:07 vote accept jonsca
Jan 20, 2012 at 0:45
Dec 6, 2011 at 16:12 comment added Jason R Yes, that's better. I tried to rewrite to make the recursive implementation more clear.
Dec 6, 2011 at 16:10 history edited Jason R CC BY-SA 3.0
incorporated yoda's suggestion
Dec 6, 2011 at 15:18 comment added Lorem Ipsum Maybe rewriting it as $A_{x,i}=x[i]+A_{x,i-1},\ A_{x,0}=x[0]$ will make it clear that you need to add only two numbers at each step, lest someone implement it as summing all $i$ elements of $x$ at each step.
Dec 6, 2011 at 13:34 history answered Jason R CC BY-SA 3.0