Two service desks both keep a caller waiting two minutes on average. At one desk the wait is exactly two minutes every time, while at the other a call is sometimes answered at once and sometimes after four minutes. Knowing only the mean, you cannot tell which desk you are calling. This lesson defines variance, the expected squared distance from the mean, computes it in two ways that must agree, and explains why it is measured in squared units and when it is finite.
Key terms
Deviation from the mean
Definition Let have finite expectation . The deviation of from its mean is the random variable . Its value is positive on outcomes where lies above the mean, negative where lies below it and zero where . By linearity,
In plain words A deviation says how far one outcome lies from the center and on which side. The signed deviations of any variable with a finite mean balance exactly, so their average cannot measure spread. A measure of spread built by averaging deviations has to remove the signs first.
Example Let a waiting time be , or minutes with probabilities , and . Its mean is minutes, and the deviations are , and minutes. Their weighted average is , although half of the probability sits away from the mean. The sign describes position relative to the mean, so a deviation of minutes is not a negative waiting time.
Variance
Definition Let have finite expectation . The squared deviation is a nonnegative random variable, and the variance of is its expectation,
For a discrete variable with PMF ,
The variance is either a number in or , and it is finite exactly when has a finite second moment. It equals exactly when , so for a discrete variable exactly when every value with positive probability equals the mean. Variance is a property of a probability model. Estimating an unknown variance from data, with a divisor such as , is a different task.
In plain words Square each deviation, so that distances above and below the mean count alike and cannot cancel, then average the squares with the probabilities as weights. Squaring also makes large deviations count heavily, since doubling a distance multiplies its square by four.
Example For the waiting time above, the squared deviations are , and , so square minutes. A wait of exactly minutes has the same mean and variance . A wait of or minutes with probability each also has mean , but both of its squared deviations are , so its variance is square minutes. Moving probability from the center to the ends, with the mean unchanged, raised the variance from to .
Second moment
Definition The second moment of is . For a discrete variable,
All its terms are nonnegative, so it is either a finite number or , and has a finite second moment when . A finite second moment implies a finite expectation, because for every real . For with finite expectation , the inequalities and show that the variance is finite exactly when the second moment is finite, and the variance is when . If has no finite expectation, there is no real number to center at, and the definition of variance does not apply. Every variable with finitely many values, and more generally every bounded variable, has a finite second moment.
In plain words The second moment averages the squared outcomes themselves, measured from zero rather than from the mean. A distribution with unbounded values can have a finite mean and an infinite second moment, because squaring makes rare large values count heavily enough for the sum to diverge.
Example For the waiting time above, the squared outcomes are , and square minutes, so square minutes. For an infinite second moment, let take the value with probability for . The probabilities add to , and
The first sum is , while every term of the second equals . So has a finite mean and .
Computational formula for variance
Definition If has a finite second moment and , then
To see why, expand the square and apply linearity, which is allowed because , and the constant all have finite expectations,
Because a variance is never negative, it follows that , with equality exactly when is constant with probability one.
In plain words The variance is the mean of the squares minus the square of the mean. This route is often quicker by hand, since it avoids subtracting the mean from every value. When the two terms are large and nearly equal, subtracting rounded decimals can lose much of the accuracy, and exact fractions or the centered definition are safer.
Example For the waiting time above, and square minutes, so square minutes, which matches the calculation from squared deviations.
Squared units
Definition If is measured in some unit, the deviation has the same unit, and is measured in the square of that unit, since probabilities carry no unit. The standard deviation returns to the original unit. It is the root-mean-square deviation, the square root of the mean of the squared deviations. If has finite variance and and are constants, then
because the deviation of from its mean is . A shift leaves the variance unchanged, and a factor multiplies it by .
In plain words A variance of square minutes is not an average distance of minutes. To compare the spread with the mean or with the outcomes themselves, take the square root. Changing units from minutes to seconds multiplies every deviation by and the variance by .
Example The waiting time above has variance square minutes and standard deviation minutes. Adding a fixed minutes to every wait gives , whose mean is minutes and whose variance is still square minutes. Tripling every wait gives , with variance square minutes and standard deviation minutes.
Check yourself
- A waiting time is , or minutes with probabilities , and . Find its mean, then its variance, once from the squared deviations and once from the second moment. Give units.
Show the answer
The mean is minutes. The deviations are , and minutes, with squares , and , so the variance is square minutes.
The second moment is square minutes, and square minutes again. The standard deviation is minutes.
- A waiting time has variance square minutes. Someone converts the times to seconds and reports a variance of . What went wrong, and what are the correct variance and standard deviation in seconds?
Show the answer
If is the waiting time in minutes, the time in seconds is . Every deviation is multiplied by , so every squared deviation, and with them the variance, is multiplied by . The correct variance is square seconds. The reported value multiplies by only once, as if the variance were measured in minutes. The standard deviation is seconds, in agreement with .
- Can a random variable have mean and second moment ? Can it have mean and second moment ? Give an example where one exists.
Show the answer
With mean and second moment , the computational formula would give a variance of . A variance is the expectation of a nonnegative variable, so it cannot be negative, and no such random variable exists.
With mean and second moment , the variance would be , which is possible. For example, let be or with probability each. Then and .