A whole lot of DEVIATION

Started by
0 comments, last by quarnin 22 years, 3 months ago
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
Advertisement
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
/Mankind gave birth to God.

This topic is closed to new replies.

Advertisement