Archived

This topic is now archived and is closed to further replies.

quarnin

A whole lot of DEVIATION

Recommended Posts

quarnin    122
Let standard deviation = sqrt((sum(x^2) - sum(x)^2)/n) Anyone have a good algorithm for calculating Standard Devatiion "on the fly" so that you don''t overflow on summing the x^2? Thanks, Steve

Share this post


Link to post
Share on other sites
DDnewbie    122
Hi,

Isn't your formula a bit wrong?
Shouldn't it be:
std = sqrt(1/sqrt(N-1)) * sqrt( sum(x^2)- sum(x)^2/N )

N = [total number of observations]

Anyway, why don't you use this formula:
std = 1/sqrt(N-1) * sum((x(i) - mean(x))^2)
where x(i) is the i:th element.

Then you ought not to get an overflow.



/Mankind gave birth to God.

Edited by - silvren on December 31, 2001 3:31:36 PM

Share this post


Link to post
Share on other sites