# Variance

Variance is the average of the squared differences of a random variable from its mean. It is a statistical measurement of variability that indicates how far a set of numbers varies from the average value. A high variance tells us that the collected data has higher variability, and the data is generally farther from the mean. A low variance tells us the opposite, that the collected data is generally similar, and does not deviate much from the mean.

Variance is used throughout statistics in areas such as descriptive statistics, inferential statistics, hypothesis testing, and more.

## Variance formulas

The formula for variance changes depending on whether the variance is being calculated for a population or for a sample. Generally,

where σ is the standard deviation (of the population) and variance is the square of the standard deviation.

For a population:

where σ^{2} is the variance of the population, x_{i} is the i^{th} value, μ is the population mean, and N is the number of data points for the population.

For a sample:

where s^{2} is the variance of the sample, x_{i} is the i^{th} value, is the sample mean, and n is the number of data points in the sample.

Which formula to use depends entirely on whether the collected data represents a sample of the population or the entire population. Refer to the respective pages for population and sample for further information.

Example

Find the variance given the sample weights of 127, 134, 155, 171, and 202.

1. Calculate the sample mean:

2. Calculate the sum of squares (SS):

SS = | |

= | (127 - 157.8)^{2} + (134 - 157.8)^{2} + (155 - 157.8)^{2} + (171 - 157.8)^{2} + (202 - 157.8)^{2} |

= | 3650.8 |

3. Divide SS by 1 less than the total number of scores in the sample:

## Variance and standard deviation

Variance is commonly used to calculate the standard deviation, another measure of variability. Standard deviation is a rough measure of how much a set of numbers varies on either side of their mean, and is calculated as the square root of variance (so if the variance is known, it is fairly simple to determine the standard deviation).

One useful property of the standard deviation is that since it is the square root of variance, the standard deviation will be a unit of measurement consistent with the random variable in question, rather than a square of the unit, as is the variance.

For instance, given a set of heights measured in meters, the variance would be in units of squared meters. In contrast, the standard deviation would be measured in meters.

Example

Given that the mean of the measured heights is 1.7 m with a standard deviation of 0.1 m, find the range of heights that fall within one, two, and three standard deviations.

1 standard deviation: 1.7 ± 0.1 = 1.6 - 1.8 m

2 standard deviations: 1.7 ± 2(0.1) = 1.5 - 1.9 m

3 standard deviations: 1.7 ± 3(0.1) = 1.4 - 2.0 m

In a standard normal distribution, 68% of the values lie within 1 standard deviation from the mean, 95% lie within 2 standard deviations from the mean, and 99.7% lie within 3 standard deviations from the mean. Based on the above data, this would mean that 99.7% of people in the sample are between 1.4 and 2.0 m tall, 95% are between 1.5 and 1.9 m tall, and 68% are between 1.6 and 1.8 m tall.