nature-of-code / noc-book

The Nature of Code book (archived repo, see README for new repo / build system!)
http://natureofcode.com
1.94k stars 365 forks source link

"Calculating Mean and Standard Deviation" section shows incorrect values #140

Closed augustoclaro closed 5 years ago

augustoclaro commented 7 years ago

The shown avarage variance is 254.23, but the correct one would be 228.81.

the sum of variances is 2288.1 and seems like it's dividing by 9 (to have 254.23) instead of by 10 (the correct length of the array, which will give us 228.81).

nonas-hunter commented 6 years ago

This confusion come from the difference between Population Standard Variance and Sample Standard Variance.

In the book, Shiffman is using Sample Standard Variance (254.23). However the 228.81 comes from Population Standard Variance.

I found this article to be very helpful in describing the difference: click here

cjonsmith commented 6 years ago

Looks like this issue was corrected as a part of #65 🙂

shiffman commented 5 years ago

Thanks everyone for the comments! Closing this issue, feel free to flag it in noc-book-2