The central tendency measures (mean, mode and median) sometimes aren't enough descriptives in a data set analysis. For example, given two lists A=[15, 15, 15, 14, 16] and B=[2, 7, 14, 22, 30] the mean is μ=15 in both cases, however the values of second list are clearly more spread out from the average value. The standard deviation (also called sigma, the greek lowercase letter σ) measures the spread of the values in a data set and transform the "clearly more spread out than" assertion in a proofed statistical assertion.
The standard deviation is calculated following five steps:
Given a list of values return the standard deviation rounded to the nearest hundredth.
standard_deviation([3, 5, 7]) ➞ 1.63
// |(3-5)|+|(5-5)|+|(7-5)| = 2² + 0 + 2² = 8 / 3 = square root of 2.66 = 1.63
standard_deviation([5, 5, 5]) ➞ 0
// Values aren't deviating from the mean.
standard_deviation([-3, -5, -7]) ➞ 1.63
// Remember: absolute differences!