## The Problem

The variance is a measure of the variability in the data. The standard deviation is also a measure of how spread out the data are. The main advantage of the variance over the standard deviation is that variances do not involve a square root, which means variances can be easily added — standard deviations cannot.

Because the variance uses the mean in its calculations, it would only make sense to use it if the mean should also have been used. Thus, data that are highly skewed should not use the variance to represent variability. To illustrate calculating the variance, assume that you collected the following 9 data values:

4, 22, 80, 50, 3, 83, 68, 0, 44

Calculate the variance of this sample, s².

## Your Answer

You got the correct answer of **1116.75**. Congratulations!

Unfortunately, your answer was not correct. Either try again or click on “Show Solution” below to see how to obtain the correct answer.

## Assistance

Hide Solution

$$
\begin{align}
s^2 &= \frac{1}{n-1} \sum_{i=1}^{n} (x_i-\bar{x})^2 \\
&= \frac{1}{9-1} \sum_{i=1}^{9} (x_i-39)^2 \\
&= \frac{1}{8} \left( (4-39.3333)^2 + (22-39.3333)^2 + (80-39.3333)^2 + (50-39.3333)^2 + (3-39.3333)^2 + (83-39.3333)^2 + (68-39.3333)^2 + (0-39.3333)^2 + (44-39)^2 \right) \\
&= \frac{1}{8} \left( (-35.3333)^2 + (-17.3333)^2 + (40.6667)^2 + (10.6667)^2 + (-36.3333)^2 + (43.6667)^2 + (28.6667)^2 + (-39.3333)^2 + (4.6667)^2 \right) \\
&= \frac{1}{8} \left( (1248.4444) + (300.4444) + (1653.7778) + (113.7778) + (1320.1111) + (1906.7778) + (821.7778) + (1547.1111) + (21.7778) \right) \\
\end{align}
$$

Thus, the variance of these 9 values is 1116.75.

Hide the R Code

Copy and paste the following code into your R script window, then run it from there.

sample = c(4, 22, 80, 50, 3, 83, 68, 0, 44)

var(sample)

In the R output, the sample variance is the number output by the script.

Hide the Excel Code

Copy and paste the following code into your Excel spreadsheet window, making sure your cursor is in `A1`

when you paste.

sample

4

22

80

50

3

83

68

0

44

=VAR.S(A2:A10)

Note that the function in Excel is `VAR.S`

and *not* `VAR.P`

, which returns the *population* variance.