http://qs321.pair.com?node_id=1207591


in reply to Excel or Perl for simple statistics?

There are generally two types of standard deviation calculations, one for when your data represents a sample of the population, and one where it represents the whole population. The former divides the squared deviations by N-1 (the sample count minus 1), whereas the latter divides by N.

As pryrt points out, you can get Statistics::Basic to do both by setting UNBIAS to true, whereas Statistics::Lite gives you two separate functions. Note also that Statistics::Basic defaults to a precision of 2 decimal points - this can be changed by setting IPRES to the desired precision.

Just for fun I did a little comparison table:

 
Excel STDEV 0.41068873 STDEVP 0.400791162
Open Office STDEV 0.4106887305 STDEVP 0.400791162
Statistics::Lite stddev() 0.410688730467897 stddevp() 0.400791162022762
Statistics::Basic stddev()
UNBIAS true
0.410688730467897 stddev() 0.400791162022762