17
May 26

Unit 3.4. Measures of variability

Chapter 3. Describing Data: Numerical

Unit 3.4. Measures of variability

Range. The smallest observation, denoted $latex \min {x_i}$, in terms of the ordered representation is, obviously, the leftmost point $latex {y_1}$. Similarly, the largest observation $latex \max {x_i}$ is the rightmost point $latex {y_n}$. Thus, $latex \min {x_i} = {y_1}$, $latex \max {x_i} = {y_n}$.

  1. Sometimes people call by the range the difference $latex {\rm{Range}} = {y_n} - {y_1}$.
  2. It also makes sense to use this name for the segment $latex {\rm{Range}} = [{y_1},{y_n}]$. This is the smallest segment containing the sample.

Figure 3.4. Five number summary.

There are three main types of quantiles: quartiles, deciles and percentiles. The idea behind them is the same as with the median: certain intervals should contain certain fractions of the total number of observations.

Quantiles. In case of quartiles we want the picture in Figure 3.4 where each of the intervals $latex ({Q_0},{Q_1}),\,({Q_1},{Q_2})$, $latex ({Q_2},{Q_3}),\,({Q_3},{Q_4})$ contains 25% of all observations.

This leads to the following definition:

$latex {Q_1} = \textrm{observation numbered}\ 0.25(n + 1),$

$latex {Q_3} = \textrm{observation numbered}\ 0.75(n + 1).$

Actually, one has to take integer parts of the numbers $latex 0.25(n + 1)$, $latex 0.75(n + 1)$ to apply this definition. Similarly,

$latex k\textrm{th decile is the observation numbered}\ \frac{k}{{10}}(n + 1),$

$latex k\textrm{th percentile is the observation numbered}\ \frac{k}{{100}}(n + 1).$

In the literature you can see other definitions and none of them is perfect because all are approximate. Think about it: if you have just 20 observations, how can you divide them into 100 equal parts?

Interquartile range. As explained in NCT, the range depends on outliers. When this is a problem, the spread of the middle 50% of the data may be preferable. This gives us the definition of the interquartile range, or IQR: $latex IQR = {Q_3} - {Q_1}$.

Five-number summary. A five-number summary is the set of numbers in Figure 3.4:

$latex \min {x_i} = {Q_0} \le {Q_1} \le {Q_2} = \textrm{median} \le {Q_3} \le {Q_4} = \max {x_i}.$

Recall that the idea is to divide the sample in four parts that contain (about) the same number of observations.

Sample variance. The sample variance is defined by

$latex s_x^2 = \frac{1}{{n - 1}}\left[ {{{({x_1} - \bar x)}^2} + ... + {{({x_n} - \bar x)}^2}} \right]. \qquad (\textrm{Eq. 3.4})$

A few names will help you understand this construction. $latex {x_1},...,{x_n}$ are the observed points. The differences $latex {x_i} - \bar x$ are called deviations from the mean. $latex {({x_i} - \bar x)^2}$ are squared deviations. Their average would be

$latex \frac{1}{n}\left[ {{{({x_1} - \bar x)}^2} + ... + {{({x_n} - \bar x)}^2}} \right].$

In the definition of $latex s_x^2$ there is division by $latex n - 1$ instead of $latex n$ for reasons to be explained in Unit 7.2.

Exercise 3.1. If you can't tell directly from the definition how to calculate $latex s_x^2$, I insist that you do everything on the computer.

  1. If you are using the same Excel file as before, in cells D2-D21 you should have simulated observations on stock price. In cell G1 type Mean and in G2 enter the formula =SUM($D$2:$D$21)/20. This is the average of the values $latex {s_1},...,{s_{20}}$; the dollar signs will prevent the addresses from changing when you copy the formula to other cells.
  2. Copy the formula to G2-G21. We want the same constant in G2-G21 to produce a horizontal line on the graph.
  3. Select columns D, G and "Line" in "Insert/Line". The time series plot is good to see the variability in the series. The sample mean is shown by a horizontal line. Some observations are above and others are below the mean, therefore some deviations from the mean are positive and others are negative.
  4. In H1 type Deviations, in H2 type =D2-G2 and copy this to H3-H21. In I1 type Squared deviations, in I2 enter =H2^2 and copy this to I3-I21. You can notice that deviations have alternating signs and squared deviations are nonnegative.
  5. In H22 type =SUM(H2:H21)/20 and in I22 enter the formula =SUM(I2:I21)/19. The value in H22, the average of deviations, will be close to zero showing that the mean deviation is not a good measure of variability. The value in I22 is $latex s_x^2$.

Standard deviation. The quantity $latex {s_x} = \sqrt {s_x^2}$ is called a sample standard deviation.

Lessons to be learned. Both sample variance and sample standard deviation are used to measure variability (or volatility, or spread). Both are based on deep mathematical ideas and for now you have to accept them as they are. Unlike the range or IQR, both depend on all observations in the sample.

If you understand the arithmetic calculations, it does not necessarily mean that you understand the meaning. Read again the above procedure and make sure you see the forest behind the trees. You should be able to reproduce the definitions and, if necessary, use the calculator instead of Excel.

Exercise 3.2.

(a) What happens to $latex s_x^2$ if all observations are increased by 5? Try to give two different explanations.

(b) Can the sample variance be negative?

(c) If the sample variance is zero, what can you say about the variable?


Previous: Shape of the distribution | Next: Measures of relationships


Want the whole book (all 14 chapters, exercises, and the index) as a single PDF? Available on Lulu for $1.99.

Leave a Reply

You must be logged in to post a comment.