Method: Utilities::Statistics#standard_deviation
- Defined in:
- lib/utilities/utilities.rb
#standard_deviation(population = false) ⇒ Object Also known as: std_dev
Return the (sample|population) standard deviation of self If population is set to true, then we consider the dataset as the complete population Else, we consider the dataset as a sample, so we use the sample standard deviation (size - 1)
73 74 75 76 |
# File 'lib/utilities/utilities.rb', line 73 def standard_deviation( population = false ) return nil if empty? size > 1 ? Math.sqrt( variance( population ) ) : 0.0 end |