## 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 8 data values:

87, 89, 90, 39, 9, 60, 87, 1

Calculate the variance of this sample, s².

## Your Answer

You got the correct answer of **1383.0714**. 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}{8-1} \sum_{i=1}^{8} (x_i-58)^2 \\
&= \frac{1}{7} \left( (87-57.75)^2 + (89-57.75)^2 + (90-57.75)^2 + (39-57.75)^2 + (9-57.75)^2 + (60-57.75)^2 + (87-57.75)^2 + (1-58)^2 \right) \\
&= \frac{1}{7} \left( (29.25)^2 + (31.25)^2 + (32.25)^2 + (-18.75)^2 + (-48.75)^2 + (2.25)^2 + (29.25)^2 + (-56.75)^2 \right) \\
&= \frac{1}{7} \left( (855.5625) + (976.5625) + (1040.0625) + (351.5625) + (2376.5625) + (5.0625) + (855.5625) + (3220.5625) \right) \\
\end{align}
$$

Thus, the variance of these 8 values is 1383.0714.

Hide the R Code

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

sample = c(87, 89, 90, 39, 9, 60, 87, 1)

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

87

89

90

39

9

60

87

1

=VAR.S(A2:A9)

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

and *not* `VAR.P`

, which returns the *population* variance.