#### Archived

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

# A whole lot of DEVIATION

This topic is 6188 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

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 on other sites
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

1. 1
2. 2
3. 3
Rutin
19
4. 4
khawk
14
5. 5
frob
12

• 9
• 11
• 11
• 23
• 12
• ### Forum Statistics

• Total Topics
633657
• Total Posts
3013197
×