Pulsars
0 %
Log inSign up

Measuring spread

Variance and standard deviation

Two games can share the same expected value and have nothing in common: one calm, the other risky. What the expected value ignores, the variance measures.

The problem

Game Rule Expectation
A win €1 with probability 12\dfrac{1}{2}, lose €1 otherwise E=0E = 0
B win €1000 with probability 12\dfrac{1}{2}, lose €1000 otherwise E=0E = 0

Same expectation, same fairness — and yet nobody confuses them. A measure of the spread of values around the mean is missing.

Variance

V(X)=E[(XE(X))2]V(X) = E\left[\,(X - E(X))^2\,\right]

We measure each value's distance to the mean, square it — so that negative deviations do not cancel positive ones — and take the weighted average:

V(X)=(xiE(X))2P(X=xi)V(X) = \sum (x_i - E(X))^2 \cdot P(X = x_i)

The variance is always positive or zero. It is zero only if XX is constant.

The computational formula

Expanding the square gives a much faster formula, the König-Huygens one:

V(X)=E(X2)[E(X)]2V(X) = E(X^2) - \left[E(X)\right]^2

« The mean of the squares minus the square of the mean. » This is the one used in practice. For a fair die:

E(X)=3.5E(X2)=12+22+32+42+52+626=91615.17E(X) = 3.5 \qquad E(X^2) = \frac{1^2 + 2^2 + 3^2 + 4^2 + 5^2 + 6^2}{6} = \frac{91}{6} \approx 15.17

V(X)=15.173.52=15.1712.25=2.92V(X) = 15.17 - 3.5^2 = 15.17 - 12.25 = 2.92

Standard deviation

The variance is expressed in the square of the unit: euros² for a gain, which means nothing concrete. So we take its square root:

σ(X)=V(X)\sigma(X) = \sqrt{V(X)}

This is the standard deviation, in the unit of XX. For the die, σ=2.921.71\sigma = \sqrt{2.92} \approx 1.71: results deviate on average by about 1.71.7 from the mean of 3.53.5.

Back to the two games above:

Game Variance Standard deviation
A V=1V = 1 σ=1\sigma = 1
B V=106V = 10^6 σ=1000\sigma = 1000

Game B is a thousand times riskier. The standard deviation puts an exact figure on what intuition said.

The properties

V(aX+b)=a2V(X)σ(aX+b)=aσ(X)V(aX + b) = a^2 \cdot V(X) \qquad \sigma(aX + b) = |a| \cdot \sigma(X)

Two lessons:

  • adding a constant translates the whole distribution without changing its spread — dispersion is insensitive to shifts;
  • multiplying by aa multiplies the variance by a2a^2, hence the standard deviation by a|a|.
             μ                        μ + 5
     ___/\___                     ___/\___
    /        \        + 5        /        \          same shape,
   /          \     ------>     /          \         same standard deviation
  ------------------          ------------------

Careful though: V(X+Y)=V(X)+V(Y)V(X + Y) = V(X) + V(Y) holds only if XX and YY are independent. That is the big difference from the expected value, which always adds.

Summary

  • The variance V(X)=E[(XE(X))2]V(X) = E[(X - E(X))^2] measures the spread around the mean.
  • Computational formula: V(X)=E(X2)[E(X)]2V(X) = E(X^2) - [E(X)]^2.
  • The standard deviation σ=V\sigma = \sqrt{V} is in the unit of XX: that is what gets interpreted.
  • V(aX+b)=a2V(X)V(aX + b) = a^2 V(X): the shift bb has no effect on dispersion.
  • V(X+Y)=V(X)+V(Y)V(X + Y) = V(X) + V(Y) requires independence — unlike the expected value.