Contents

Standard Deviation

For set of numeric values we can calculate their mean (as in Average of an Array problem). However, average or mean is often not sufficient metric.

For example if here is a company with three employees and their average salary is 1000 dounds - suppose it is good salary in some imaginary country - but it may happen that one of them has salary of 2500 while two others receive only 250 dounds and in reality it is both unjust and insufficient.

Standard deviation is the measure of "how close" are values of the set to the arithmetic mean. I.e. it is mathematical synonim of "justness" for example above. It is calculated in following way:

  1. For set {X} calculate the mean of the numbers M = mean({X}).
  2. For each member Xi of the set {X} calculate its quadratic distance D from the mean, i.e. Di = (M - Xi)^2.
  3. The square root of the mean of these distances is the Standard Deviation d = sqrt(mean({D})).

Standard Deviation is measured in the same units as values and their mean. Let's calculate d for the example with salaries mentioned above:

M = (2500 + 250 + 250) / 3 = 1000
D1 = (1000 - 2500)^2 = 2250000
D2,D3 = (1000 - 250)^2 = 562500
mean({D}) = (2250000 + 562500 + 562500) / 3 = 1125000
d = sqrt(mean({D})) = sqrt(1125000) = 1061

I.e. deviation from average salary (1061 dounds) is greater than this average salary itself (1000 dounds)! So we see, standard deviation is the mathematical synonim of unjustness in this case.

Other sense of the standard deviation is the measure of volatility for some value (e.g. price of the goods etc. over time). The Share Price Volatility problem provides a good example of how this could be used.