Title: Default for 36.1 Describing Data
Course: HELM Workbooks 2023-2024

Introduction to statistics

Many students taking degree courses involving the sciences and technology have to study statistics. This quiz will enable you to understand the meaning and interpretation of numerical and diagrammatic statements involving data.

Many different definitions of statistics have been given. These include the following.

- "The collection, organisation, analysis and interpretation of numerical data''
- "The methodological basis of the natural sciences''
- "The study of uncertainty''

Why is this of any interest?

Consider the following two activities which we will describe as experiments. In statistics we use the word "experiment'' to refer to an activity which involves recording outcomes, even when this does not take place in a laboratory.

1. We measure the breaking strength of ten 15-cm specimens of nylon cord.
2. We count the number of vehicles turning right at a road junction in a 30-minute period.

The first of these involves measurement. The second involves counting.

Now consider repeating the experiments. The results will most likely not be the same (cord specimen strengths will vary if measured very accurately; the numbers of vehicles turning right will probably differ). So the result of any one experiment will not be exactly representative of all samples of cord or all 30-minute periods. In this sense, no result is "true''. Even if the result happened to be "exactly representative'' we would have no way of knowing this.

These problems are almost universal features of investigating the world around us. We have:

1. Measurement error.
2. Differences between individuals. We (usually) can not observe all individuals and it is often more efficient not to do so anyway.
3. Differences between samples of material or time and we can not observe all possible samples.
4. Other variation which affects the results in an unpredictable way.

So what can we do?

Statistics deals with uncertainty. Its aims include the following:

1. To keep uncertainty to a minimum.
2. To quantify the remaining uncertainty.
3. To make precise statements in situations involving uncertainty.

These aims apply in all sorts of situations.

Variables

A variable is a quantity which can take different values, perhaps in different experiments. For example this could be the breaking strength of a nylon cord or the number of right-turning vehicles in a 30-minute period.

Variables may be:

Quantitative: i.e. numerical, e.g. breaking strengths of cords, numbers of vehicles.

Qualitative: usually categorical, e.g. make of a car, voting intention of a voter, cause of failure in a machine.

Quantitative variables may be:

Continuous: i.e. measured on a continuous scale. E.g. height of a student, breaking strength of a cord.

Discrete: i.e. only certain separate values, e.g. integers, are possible. E.g. number of right-turning vehicles, goal difference of a football team.

When we do an experiment we observe a value taken by a variable. This value is called an observation (e.g. the breaking strength of a particular cord specimen). We may make several observations and collectively these are known as data (e.g. the breaking strengths of ten particular cord specimens).

Variables are often denoted by upper case letters such as \(X\). Observations are often denoted by the corresponding lower case letters such as \(x\).

Population and sample

Population: Suppose, for example, we are interested in individuals who belong to a certain group (e.g. students in the first year of UK Engineering degree courses or all TV sets made at a particular factory during October 2015). We call the group a population.

Sample: Often it is not possible to observe every member of a population and it is usually not sensible to try. Instead we observe only some members of the population. The members which we observe are called a sample. For example we might observe a sample of 15 cm long nylon cord specimens. Clearly it would not be sensible to try to test to destruction all possible 15 cm long nylon cord specimens. The nylon cord example illustrates the point that, in some cases, there are so many potential members of a population that the size of the population may be treated as infinite. We could always take more sample specimens and the result for one specimen does not affect the properties of any future specimens which we might take.

Introduction to descriptive statistics

In later Workbooks we will consider formal methods for making inferences about a population based on observation of a sample. Before doing this we will consider simple methods for describing and summarizing the observations in a sample, both numerically and graphically. These descriptive methods can be an important first step before we go on to apply more formal analyses. In fact errors can often be avoided by considering suitably chosen graphs before we go any further. In addition, clear presentation of numerical and graphical summaries of data is an important feature of reporting results.

A statistic is a numerical summary of a sample of data. Later in this Workbook we will look at a number of statistics. First we will look at tabulating data and graphical representations.

Frequency tables

Rather than just present a list of the data it is useful to tabulate them in a way which is more informative. Often this is done by making a frequency table. Usually nowadays we use computer software to do such tasks but it is useful to understand the process involved and the meanings of various terms.

Categorical data

Suppose that we observe vehicles at a crossroads for thirty minutes. Consider just the vehicles arriving at the junction from the South. Such vehicles can carry straight on to go North, turn left to go West or turn right to go East. Suppose that we see \(147\) of these vehicles go North, \(85\) go West and \(43\) go East.

Frequency: The numbers \(147, 85\) and \(43\) are the frequencies of these three directions. In general, for categorical (i.e. qualitative) data, the frequency for a particular value of the variable is the number of times that value is observed in the sample.

Total frequency: The total frequency is the total number of observations. In this case it is \(147+85+43=275\).

Relative frequency: The relative frequency is the proportion of the observations which fall in a particular category. It is the frequency divided by the total frequency. In the example the relative frequencies are \(147/275=0.535\), \(85/275=0.309\) and \(43/275=0.156\). The total of the relative frequencies is 1.

Here is a frequency table for the road junction data.

Direction | Frequency | Relative frequency
North | \(147\) | \(0.535\)
West | \(85\) | \(0.309\)
East | \(43\) | \(0.156\)
Total | \(275\) | \(1.000\)

Note that, in some cases, it is necessary to include an "Other'' category for unusual observations.

Discrete data

A frequency table for discrete data is very similar to one for categorical data except that we put the values of the variable in increasing order.

For example, the numbers of vehicles passing a point on a road in each of 100 intervals of length one minute are recorded. These data are summarised in the frequency table below.

Numbers of Vehicles \(x\) | Frequency | Cumulative Frequency | Relative Frequency | Cumulative Relative Frequency
0 | 0 | 0 | 0.00 | 0.00
1 | 0 | 0 | 0.00 | 0.00
2 | 0 | 0 | 0.00 | 0.00
3 | 4 | 4 | 0.04 | 0.04
4 | 3 | 7 | 0.03 | 0.07
5 | 5 | 12 | 0.05 | 0.12
6 | 8 | 20 | 0.08 | 0.20
7 | 10 | 30 | 0.10 | 0.30
8 | 19 | 49 | 0.19 | 0.49
9 | 12 | 61 | 0.12 | 0.61
10 | 13 | 74 | 0.13 | 0.74
11 | 7 | 81 | 0.07 | 0.81
12 | 4 | 85 | 0.04 | 0.85
13 | 11 | 96 | 0.11 | 0.96
14 | 0 | 96 | 0.00 | 0.96
15 | 1 | 97 | 0.01 | 0.97
16 | 2 | 99 | 0.02 | 0.99
17 | 0 | 99 | 0.00 | 0.99
18 | 1 | 100 | 0.01 | 1.00
\(x > 18\) | 0 | 100 | 0.00 | 1.00
Total | 100 |  | 1.00 |

We have also included the cumulative frequency and the cumulative relative frequency.

Cumulative frequency: The cumulative frequency for a value \( x_{i}\) of a discrete variable \(X\) is the total frequency for values of \(X\) where \(X \leq x_{i}\).

Cumulative relative frequency: The cumulative relative frequency is the cumulative frequency divided by the total frequency.

Notice that we have also included a category "\(x>18\)'' since there is not a definite upper limit to the number of vehicles which we might observe.

Continuous data

When we have continuous data it does not make sense to count how many times each value occurs. This is because, at least if we measured to a great enough precision, no two observations would be exactly the same. Therefore we need to form the observations into groups, called classes. We do this by dividing the range of possible values of the variable into a set of non-overlapping intervals called class intervals.

The following data are the heights (to the nearest tenth of a centimetre) of 30 students studying statistics.

150.2 | 167.2 | 176.2
160.1 | 151.8 | 166.3
162.3 | 167.4 | 178.3
181.2 | 175.7 | 161.1
179.3 | 168.9 | 164.8
165.0 | 177.1 | 183.2
172.1 | 180.2 | 168.2
173.8 | 164.3 | 176.8
184.2 | 170.9 | 172.2
168.5 | 169.8 | 176.7

Notice first of all that all of the numbers lie in the range 150 cm. - 185 cm. This suggests that we try to organize the data into classes as shown below. This first attempt has deliberately taken easy class intervals which give a reasonable number of classes and span the numerical range covered by the data.

Class | Class Interval
\(1\) | \(150 - 155\)
\(2\) | \(155 - 160\)
\(3\) | \(160 - 165\)
\(4\) | \(165 - 170\)
\(5\) | \(170 - 175\)
\(6\) | \(175 - 180\)
\(7\) | \(180 - 185\)

The number of classes which we use will depend on the number of observations and the purpose of the frequency table.

Our definition of the classes above is ambiguous. For example, to which class should the number 165 be allocated? Should it be in the class interval 160-165 or in the class interval 165-170?

Rather than adopt an arbitrary convention such as always placing boundary values in the higher (or lower) class we usually define the class boundaries in such a way that such difficulties do not occur. Therefore, we define the classes in a way which resolves this ambiguity. For example, we can define the second class as \(155 \leq x < 160\), where \(x\) is the value of the observation. Alternatively, we can simply write the class interval as \([155,160)\) where the square bracket indicates that the boundary value is included and the round bracket indicates that it is not. Our classes are now as follows.

Class | Class Interval
\(1\) | \([150,\ 155)\)
\(2\) | \([155,\ 160)\)
\(3\) | \([160,\ 165)\)
\(4\) | \([165,\ 170)\)
\(5\) | \([170,\ 175)\)
\(6\) | \([175,\ 180)\)
\(7\) | \([180,\ 185)\)

Notice that the need to consider observations which lie on a class boundary only arises because, in reality, we only record values to a limited number of decimal places. Another method which is sometimes suggested is to define the class boundaries to one more decimal place than the observations.

When working by hand, the data can be organised into a frequency table using a tally count. To do a tally count, as you work through the data set, you make a mark, called a tally mark, next to the class to which an observation belongs and lightly mark or cross off the observation. When you have finished, the total number of tally marks should be equal to the number of observations.

This process gives the tally marks and the corresponding frequencies as shown below.

Class Interval (cm) | Tally | Frequency
\([150,\ 155)\) | | | | \(2\)
\([155,\ 160)\) |  | \(0\)
\([160,\ 165)\) | | | | | | | \(5\)
\([165,\ 170)\) | | | | | |    | | | | \(8\)
\([170,\ 175)\) | | | | | | \(4\)
\([175,\ 180)\) | | | | | |    | | | \(7\)
\([180,\ 185)\) | | | | | | \(4\)

It is now easier to see some of the information contained in the original data set. For example, we now know that there are no observations in the class interval \([155, 160)\) and that the class interval \([165, 170)\) contains the most entries.

Understanding the information contained in the original table is now rather easier but, as we shall see, diagrams make the situation easier to visualise.

Graphical representations

Bar charts

Bar charts can be used to represent the frequencies for categorical or discrete data. In a bar chart, we draw a bar for each value of the variable. The length of the bar is proportional to the frequency for that value. Bars can be drawn vertically or horizontally.

Absenteeism can be a problem for some engineering firms. The following discrete data represent the number of days off taken by 50 employees of a small engineering company.

6 | 4 | 4 | 5 | 0 | 4 | 3 | 6 | 1 | 3
8 | 3 | 6 | 1 | 0 | 6 | 11 | 5 | 10 | 8
2 | 4 | 6 | 6 | 6 | 6 | 5 | 13 | 11 | 6
4 | 8 | 4 | 7 | 7 | 6 | 8 | 3 | 3 | 6
3 | 2 | 3 | 6 | 2 | 2 | 3 | 2 | 4 | 0

In order to construct a bar chart we can proceed as follows.

1. Construct a frequency table for the data.
2. Draw a diagram with the range (0 - 13) on one axis and the number of days corresponding to each value (number of days off) on the other. The length of each bar is proportional to the frequency (that is proportional to the number of staff taking that number of days off).

The results appear as follows:

[Image]

Pie charts

Pie charts are often seen in magazines and newspapers. A pie chart is simply a circular diagram where the circle is divided into sectors and the angles of the sectors are proportional to the quantity represented. The quantities may be the frequencies of values of a categorical variable in a sample. Since the total area of the circle is fixed, pie charts are considered to be useful for representing proportions of a total.

The following data represent the time spent weekly on a variety of activities by the full-time employees of an engineering company, based on their assigned female/male gender at birth (AFAB/AMAB).

Hours spent on: | AMAB | AFAB
Travel to and from work | 10.5 | 8.4
Paid activities in employment | 47.0 | 37.0
Personal sport and leisure activities | 8.2 | 3.6
Personal development | 5.6 | 6.4
Family activities | 8.4 | 18.2
Sleep | 56.0 | 56.0
Other | 32.3 | 38.4

To construct a pie chart showing how the AMAB employees spend their time we proceed as follows. Note that the total number of hours spent is 168 (\(7\times 24\)).

1. Express the time spent on any given activity as a proportion of the total time spent;
2. Multiply the number obtained by 360 thus converting the proportion to an angle, in degrees;
3. Draw a chart consisting of (in this case) 6 sectors having the angles given in the table below subtended at the centre of the circle.

Hours spent on: | AMAB | Proportion of Time | Sector Angle (rounded to 1 d.p.)
Travel to and from work | \(10.5\) | \(\dfrac{10.5}{168}\) | \(\dfrac{10.5}{168}\times 360^{\circ}=22.5^{\circ}\)
Paid activities in employment | \(47.0\) | \(\dfrac{47}{168}\) | \(\dfrac{47}{168}\times 360^{\circ}=100.7^{\circ}\)
Personal sport and leisure activities | \(8.2\) | \(\dfrac{8.2}{168}\) | \(\dfrac{8.2}{168}\times 360^{\circ}=17.6^{\circ}\)
Personal development | \(5.6\) | \(\dfrac{5.6}{168}\) | \(\dfrac{5.6}{168}\times 360^{\circ}=12.0^{\circ}\)
Family activities | \(8.4\) | \(\dfrac{8.4}{168}\) | \(\dfrac{8.4}{168}\times 360^{\circ}=18.0^{\circ}\)
Sleep | \(56.0\) | \(\dfrac{56}{168}\) | \(\dfrac{56}{168}\times 360^{\circ}=120.0^{\circ}\)
Other | \(32.3\) | \(\dfrac{32.3}{168}\) | \(\dfrac{32.3}{168}\times 360^{\circ}=69.2^{\circ}\)

The pie chart obtained is illustrated below.

[Image]

Histograms

We use a histogram to represent the frequency distribution of a sample of continuous data. In a histogram, like a bar chart, we draw an element of the diagram to represent each frequency, in this case the frequency for each class. However, because a continuous variable is measured on a continuous scale, we do not have gaps like the gaps between the bars in a bar chart. Instead we draw columns, or blocks. The base of a column is the class interval on the \(x\)-axis.

Strictly speaking, the areas of the blocks forming the histogram represent the frequencies since this gives the histogram the necessary flexibility to deal with frequency tables whose class intervals are not of equal width. However, when the class intervals are of equal width, the heights of the columns are proportional to the frequencies.

Sometimes the approximate shape of the distribution of data is indicated by a frequency polygon which is formed by joining the mid-points of the tops of the blocks forming the histogram with straight lines.

A histogram, with a frequency polygon, is shown in the figure below.

[Image]

Location and spread

The statistical properties of the observations in a sample are often described as a frequency distribution, referring to the fact that some values, in the case of discrete or categorical variables, or some ranges of values, in the case of continuous variables, may have greater frequencies than others. Very often the distribution of observations in a sample is summarized using two statistics, one of which measures the location or central value of the distribution and one which measures the dispersion or spread of the values about this central value. As we shall see later, it is often important to convey information on the shape of a distribution as well. However, in many cases in practice, the shape of the distribution, as represented, for example, by a histogram, is reasonably symmetrical and roughly follows the "bell-shape'' illustrated below. In such cases the location-and-spread summary may suffice.

[Image]

Notation:

It is important to remember the distinction between a population and a sample. In later Workbooks we will look at how sample statistics can be used to give us information about summaries of a population. For now, however, we are concentrating on the sample statistics. To help keep the distinction clear, we usually use Greek letters, such as \( \mu\) or \( \sigma\), to represent population quantities, the values of which are, of course, usually unknown, and the equivalent Roman letters, such as \(m\) or \(s\), to represent sample statistics.

Measures of location

There are three widely used measures of location, these are:

- The Mean, the arithmetic average of the data;
- The Median, the central value of the data;
- The Mode, the most frequently occurring value in the data set.

Mean

This section of the booklet will show you how to calculate the mean. Strictly, we should say that this is the arithmetic mean. There are other kinds of means as well. This is by far the most common, though, and so we often just say "mean''.

Key Point

If we take a set of numbers \(x_1,x_2,\dots , x_n\), its arithmetic mean is defined as: \[\bar x =\dfrac{ x_1+x_2+x_3+\cdots+x_n}{n} = \dfrac{1}{n}\sum_{i=1}^nx_i.\]

This is often shortened to: \[\bar x=\frac{1}{n}\sum x.\]

In words, this formula says: sum the values of \(x\) and divide by the number of values you have summed.

In the case of discrete data, we have a frequency for each possible value of the variable and we can express the calculation in terms of these frequencies. Suppose that the data \(x_1, x_2, \ldots, x_n\) consists of \(J\) unique values denoted by \(k_1, k_2, \ldots, k_J\) (where we could have \(J \rightarrow \infty\)) and that these values have observed frequencies \(f_1,f_2,\ldots,f_J\). The it is easily seen that the overall count is: \[\sum_{i=1}^n x_i = \sum_{j=1}^J f_j k_j.\]

A common case is when the possible values are the nonnegative integers, \( 0, 1, 2, \ldots\). Then \[ \bar{x} = \dfrac{1}{n} \sum_{j=0}^{\infty} k_j f_{j} = \dfrac{\sum k f_{k}}{\sum f_{k}}. \]

Example

The numbers of telephone calls made on a particular day by 500 subscribers to a mobile telephone network gave the following frequency table, from which we can calculate the sample mean.

Number of Calls \(x\) | Frequency \(f\) | Count \(f x\)
0 | 13 | 0
1 | 30 | 30
2 | 85 | 170
3 | 98 | 294
4 | 96 | 384
5 | 81 | 405
6 | 42 | 252
7 | 32 | 224
8 | 17 | 136
9 | 4 | 36
10 | 1 | 10
11 | 1 | 11
 | \(\sum f = 500\) | \( \sum f x = 1952 \)

The sample mean is given by \(\bar x=\dfrac{\sum fx}{\sum f}=\dfrac{1952}{500}=3.904\).

Median and quartiles

Some statistics are derived from quantitative data which are placed in rank order. Ranking data simply means that the data are placed in order from the smallest to the largest. The smallest observation thus gets rank 1, the second smallest gets rank 2 and so on. Such statistics are called order statistics. The median is an order statistic which is used as a measure of location. It divides a sample of data into two equally sized groups, one containing the smaller observations and the other containing the larger observations. Two other order statistics which we will describe here together with the median are the Lower Quartile and the Upper Quartile. The lower quartile, median and upper quartile are also called the first, second and third quartiles respectively. They divide a sample of data into four portions according to the sizes of the observations, each portion containing the same number of observations. As you will see the Ogive or Cumulative Frequency Curve enables us to find these statistics for large data sets. Definitions for the three sample quartiles are given below. A number of slightly different definitions are used for the lower and upper quartile. One version is given here. The different definitions will usually lead to only slightly different results.

The Median; this is the central value of a sample where the numbers of larger observations and smaller observations are equal.

The Lower Quartile; this is the value which divides the observations into a lower \(25\%\) and an upper \(75\%\).

The Upper Quartile; this is the value which divides the observations into a lower \(75\%\) and an upper \(25\%\).

Calculations

We calculate the median and the lower and upper quartiles as follows. Let the number of observations be \(n\). We sort the observations into increasing order and allocate ranks. If there are ties then we just use integer ranks as usual. For example, the data 3.1, 4.6, 5.3, 5.3, 7.8, 9.5 would get ranks 1, 2, 3, 4, 5, 6 so that the observations with ranks 3 and 4 are both 5.3.

- For median, calculate \( r_{2} = \dfrac{n+1}{2}\). If \( n \) is odd \(r_{2}\) is an integer and the sample median is the observation with rank \(r_{2}\). If \(n\) is even then \(r_{2}\) is not an integer and we average the values on either side. That is we average the observations with ranks \(\dfrac{n}{2}\) and \(\dfrac{n+2}{2}\). For example, if \(n=16\), then \(r_{2}=8.5\) and we average the values with ranks \(8\) and \(9\).
- For the lower quartile, calculate \(r_{1}=\dfrac{n+2}{4}\). If \(r_{1}\) is an integer, the sample lower quartile is the observation with rank \(r_{1}\). If \(r_{1}\) is not an integer then we average the values on either side. For example, if \(n=16\), then \(r_{1}=4.5\) and we average the values with ranks \(4\) and \(5\).
- For the upper quartile, calculate \(r_{3}=\dfrac{3n+2}{4}\). If \(r_{3}\) is an integer, the sample lower quartile is the observation with rank \(r_{3}\). If \(r_{3}\) is not an integer then we average the values on either side. For example, if \(n=16\), then \(r_{3}=12.5\) and we average the values with ranks \(12\) and \(13\).

Note that \( r_{2}=\dfrac{2n+2}{4}\) so the three \(r\)-values are \[ r_{1}= \dfrac{n+2}{4},\ r_{2}=\dfrac{2n+2}{4}\ {\rm and}\ r_{3}=\dfrac{3n+2}{4}. \]

Example

For the simple data set: \[1.2, 3.0, 2.5, 5.1, 3.5, 4.1, 3.1, 2.4,\] the process is illustrated by placing the members of the data set in rank order: \[1.2, 2.4, 2.5, 3.0, 3.1, 3.5, 4.1, 5.1\]

Here \( n=8 \) so

- \( r_{1}=2.5\) and the lower quartile is \(\dfrac{2.4+2.5}{2}=2.45\),
- \( r_{2}=4.5\) and the median is \(\dfrac{3.0+3.1}{2}=3.05\),
- \( r_{3}=6.5\) and the upper quartile is \(\dfrac{3.5+4.1}{2}=3.8\).

In the case of larger samples the quantities can be approximated by using a cumulative frequency curve or ogive. The cumulative frequency distribution for the heights of the 30 students given earlier is shown below. Notice that here, the class intervals are defined in such a way that the frequencies accumulate (hence the term cumulative frequency) as the table is built up.

Height | Cumulative Frequency | Cumulative Relative Frequency (to 3 d.p.)
less than 145 | 0 | 0.000
less than 150 | 4 | 0.133
less than 155 | 7 | 0.233
less than 160 | 8 | 0.267
less than 165 | 15 | 0.500
less than 170 | 17 | 0.567
less than 175 | 20 | 0.667
less than 180 | 26 | 0.867
less than 185 | 27 | 0.900
less than 190 | 30 | 1.000

To plot the ogive or cumulative frequency curve, we plot the heights on the horizontal axis and the cumulative frequencies or cumulative relative frequencies on the vertical axis. The corresponding ogive is shown in the figure below.

[Image: Empirical CDF of heights (HELM)]

The three statistics defined above can be read from the diagram as indicated. They are the values where the cumulative relative frequency is \(0.25, 0.50\) and \(0.75\). With \(n=30\), this corresponds to cumulative frequencies of \(7.5\), \(15.0\) and \(22.5\).

For the data set giving the heights of the 30 students, the three statistics, as obtained using the ogive, are as follows.

1. The Lower Quartile is \(155.3\).
2. The Median is \(165.15\).
3. The Upper Quartile is \(177.8\).

The mode

For discrete data, the mode is the value with the greatest frequency.

Example

In a quality control system, batches of twenty mass-produced items are examined and the number which fall outside an acceptable range in each batch is counted. The numbers of out-of-range items in fifty batches were as follows.

Number out of range (\(x\)) | \(0\) | \(1\) | \(2\) | \(3\) | \(4\) | \(5\) | \(6\)
Frequency (\(f\)) | \(9\) | \(9\) | \(13\) | \(9\) | \(8\) | \(1\) | \(1\)

The mode here is \(2\) since this value has the greatest frequency.

Note that the mean for these data is \(2.1\) and the median is \(2\).

In the case of continuous data, we do not look for a most frequent value. Strictly speaking, no two observations should be exactly the same. Instead we form a frequency table and identify the modal class, the class with the greatest frequency.

Comparison

The mean, median and mode all have their different uses. If the histogram of a sample of data is more-or-less symmetric then the median and the mean will be very similar. If it is also unimodal, that is there is only one maximum in the histogram and, since the histogram is symmetric, this is in the middle, then the mode will also be very similar. The mode will, of course be the location of the maximum in the histogram. If a frequency distribution is not symmetric (we say it is skewed in this case) then the three values can be quite different. For example, consider the distribution of incomes among the citizens of a country. Typically, the very large incomes of a small proportion of people increase the mean so that the mean is greater than the incomes of most people. Therefore, the median is less than the mean but might be a more relevant measure for most people. The mode is smaller still because of the large numbers of people with relatively small incomes.

Measures of spread

As well as summarising the location of the distribution of values in a sample using, for example, the mean, we usually also need to describe how close to this central value or far away from it the individual observations tend to be. We need to summarise the spread of the data.

The two data sets below have the same mean of \(7\) but clearly have different spreads about the mean.

- Data set \(A\): \(5, 6, 7, 8, 9\)
- Data set \(B\): \(1, 2, 7, 12, 13\)

There are several ways in which one can measure the spread of a distribution about a mean, for example

- The range - the difference between the greatest and least values;
- The inter-quartile range or IQR - the difference between the upper and lower quartiles.

Each of these measures has advantages and problems associated with it.

Measure of Spread | Advantages | Disadvantages
Range | Easy to calculate. | Depends on two extreme values and does not take into account any intermediate values.
Inter-Quartile Range | Is not as susceptible to the influence of extreme values. | Measures only the central \(50\%\) of a distribution.

Variance and standard deviation

By far the most common measures of the spread of a sample are the sample standard deviation and the sample variance. The standard deviation is just the square root of the variance so we will describe them together.

The idea of the variance is that it is the average squared deviation of an observation from the sample mean. The deviations are squared so that the negative deviations, of observations less than the mean, do not cancel out the positive deviations, of observations greater than the mean.

Suppose that we have observations \( x_{1}, \ldots , x_{n}\). Then the sample variance is defined as follows.

Key Point: Sample Variance

\[s^2=\dfrac{\sum (x_{i}-\bar x)^2}{n-1},\] where \(s^2\) is the sample variance and \(\bar x\) is the mean of the data in the sample of size \(n\).

Notice that we divide by \(n-1\) rather than \(n\). This is because we are using the deviations \( x_{i}-\bar{x}\) from the sample mean, \( \bar{x}\), and these necessarily sum to zero: \[ \sum_{i=1}^{n} (x_{i} - \bar{x}) = \sum_{i=1}^{n} x_{i} - \sum_{i=1}^{n} x_{i} = 0. \]

Therefore, if we knew the values of \( (x_{1}-\bar{x}), (x_{2}-\bar{x}), \ldots , (x_{n-1}-\bar{x})\), we would be able to work out the value of \( (x_{n}-\bar{x})\). We say that there are only \( n-1 \) degrees of freedom. As we shall see later, it also turns out that, when we want to use the sample variance to inform us about the value of the population variance, \( \sigma^{2}\), dividing by \(n-1\) instead of \(n\) is advantageous.

The sample standard deviation is simply the square root of the sample variance. It is therefore the root mean square deviation of the observations from the sample mean.

Key Point: Sample Standard Deviation

\[ s= \sqrt{s^{2}} = \sqrt{\dfrac{\sum (x-\bar x)^2}{n-1}}.\]

The standard deviation is often preferred to the variance as a summary because the standard deviation is in the same units as the data. For example, if we have a sample of weights, in kg, then the standard deviation is also in kg, whereas the variance is in \({\rm kg}^{2}\).

Example

Consider the two data sets \(A\) and \(B\) given below.

In each case the sample size is \(n=10\) and the sample mean is \(\bar{x}=7\) but the spreads are different.

DATA SET \(A\):

\(x\) | \(x-\bar{x}\) | \((x-\bar{x})^2\)
4 | -3 | 9
5 | -2 | 4
5 | -2 | 4
6 | -1 | 1
7 | 0 | 0
7 | 0 | 0
8 | 1 | 1
9 | 2 | 4
9 | 2 | 4
10 | 3 | 9
 |  | \(\sum(x-\bar{x})^2=36\)

DATA SET \(B\):

\(x\) | \(x-\bar{x}\) | \((x-\bar{x})^2\)
1 | -6 | 36
3 | -4 | 16
3 | -4 | 16
5 | -2 | 4
7 | 0 | 0
7 | 0 | 0
9 | 2 | 4
11 | 4 | 16
11 | 4 | 16
13 | 6 | 36
 |  | \(\sum(x-\bar{x})^2=144\)

For Data Set \(A\), the sample variance is \(36/9 = 4\) and the sample standard deviation is \(\sqrt{4}= 2\).

For Data Set \(B\), the sample variance is \(144/9 = 16\) and the sample standard deviation is \( \sqrt{16}= 4\).

In Data Set \(B\) the deviations from the sample mean are exactly twice the size of those in Data Set \(A\) and consequently, the sample standard deviation is also twice as big.

Calculations

To calculate either the sample variance or the sample standard deviation, we need \(\sum(x_{i}-\bar{x})^{2}\). We can calculate this by subtracting the sample mean, \(\bar{x}\), from each observation and squaring the result then summing these. However we have the following result: \[\begin{align*} \sum_{i=1}^{n}(x_{i}-\bar{x})^{2} =\sum_{i=1}^n (x_i^2-2x_i\bar x+\bar x^2) &= \sum_{i=1}^{n} x_{i}^{2} - 2 \bar{x} \sum_{i=1}^{n} x_{i} + n \bar{x}^{2} \\ & = \sum_{i=1}^{n} x_{i}^{2} - 2 n \bar{x}^{2} + n \bar{x}^{2} \\ & = \sum_{i=1}^{n} x_{i}^{2} - n \bar{x}^{2}. \end{align*}\]

It might be more convenient to use the form \[ \sum_{i=1}^{n} x_{i}^{2} - n \bar{x}^{2}, \] or \[ \sum_{i=1}^{n} x_{i}^{2} - \frac{1}{ n} \left[ \sum_{i=1}^{n} x_{i} \right]^{2},\] both of which are equal to \( \sum(x_{i}-\bar{x})^{2}\).

For discrete data, where each value \( x_{(j)}\) of the variable has a frequency \(f_{j}\) in the sample, we can replace \( \sum x_{i}\) with \( \sum f_{j} x_{(j)}\) and replace \( \sum x_{i}^{2}\) with \(\sum f_{j} x_{(j)}^{2}\).

Example

Consider the data recording the numbers of vehicles passing a point on a road in each of 100 intervals of length one minute, which are summarised in the frequency table below.

Numbers of Vehicles \(x\) | Frequency \(f\) | \(fx\) | \(fx^2\)
3 | 4 | 12 | 36
4 | 3 | 12 | 48
5 | 5 | 25 | 125
6 | 8 | 48 | 288
7 | 10 | 70 | 490
8 | 19 | 152 | 1216
9 | 12 | 108 | 972
10 | 13 | 130 | 1300
11 | 7 | 77 | 847
12 | 4 | 48 | 576
13 | 11 | 143 | 1859
14 | 0 | 0 | 0
15 | 1 | 15 | 225
16 | 2 | 32 | 512
17 | 0 | 0 | 0.00
18 | 1 | 18 | 324
Total | 100 | 890 | 8818

Therefore the sample mean is \[ \bar{x} = \dfrac{890}{100} = 8.9. \]

Recall that \[\sum(x_{i}-\bar{x})^{2} = \sum_{i=1}^{n} x_{i}^{2} - n \bar{x}^{2} = \sum_{i=1}^{n} x_{i}^{2} - \frac{1}{ n} \left[ \sum_{i=1}^{n} x_{i} \right]^{2}.\] And since we are working with discrete data, where each value \( x_{(j)}\) of the variable has a frequency \(f_{j}\) in the sample, we can replace \( \sum x_{i}\) with \( \sum f_{j} x_{(j)}\) and replace \( \sum x_{i}^{2}\) with \(\sum f_{j} x_{(j)}^{2}\). Therefore, we obtain

\[ \sum (x_i-\bar{x})^{2} = 8818 - 100 \times 8.9^{2} = 897.0 \] or \[ \sum (x_i-\bar{x})^{2} = 8818 - \dfrac{1}{100} \times 890^{2} = 897.0. \]

So the sample variance is \[ s^{2} = \dfrac{897}{99} = 9.0606 \] and the sample standard deviation is \[ s = \sqrt{9.0606} = 3.010. \]

Further comments

The sample mean and sample standard deviation are often useful to provide a concise summary of an observed frequency distribution. This is particularly the case when the frequency distribution is symmetric and unimodal. A unimodal frequency distribution is one where the histogram, at least approximately, has a shape with a single peak. If the frequencies decrease in the same way on each side of the peak, we say that the distribution is symmetric. The regions on either side of the distribution where the frequencies die out are called the left and right tails of the distribution. In a symmetric distribution, the left and right tails are like mirror images of each other.

Symmetric unimodal distributions are common but there are exceptions. The distributions of some variables tend to be asymmetric, with one tail longer than the other. For example lifetime distributions, that is the distributions of the times to failure for pieces of equipment, tend to be asymmetric, with the frequencies decreasing more slowly to the right of the mode. This is called positive skew, which means that the longer tail is on the right. In such cases it may be more useful to use the median and lower and upper quartiles to describe the distribution.

The following figure shows a histogram of a distribution with a positive skew.

[Image]

Exercise

The following data set which represents the numbers of days between consecutive failures in a machine (sorted into increasing order):

\(x = [value]\).

1. Find the mean and standard deviation of the above data set.
Syntax hint: Round up each answer at the final step and enter 3 decimal places. If the answer has less than 3 decimal places, then enter zero(s) at the end.
Mean: \(\bar{x} =\) .
Standard deviation: \(s =\)  .
2. Next, find the median and inter-quartile range
Syntax hint: Enter 1 decimal place. If the answer has less than 1 decimal place, then enter zero(s) at the end.
Median = .
Inter-quartile range = .
3. True or False?
The median and inter-quartile range might represent the bulk of the data more effectively in this case.
Feedback: (a) The sample size is \(n = 16\), so the mean is given by \[\bar{x} = \dfrac{\sum x}{16} = [value] = [value]. \] The standard deviation is \[ s = \sqrt{\dfrac{\sum(x - \bar{x})^2}{n-1}} = \sqrt{\dfrac{\sum x^2 - n\bar{x}^2}{n-1}} = \sqrt{\dfrac{[value]}{15}} =[value].\] (b) The median is the average of the observations with rank 8 and 9, so \[ \text{Median} = \dfrac{[value]+[value]}{2} = [value].\] The lower quartile is given by the average of the observations with rank 4 and 5: \[\dfrac{[value]+[value]}{2} = [value],\] and the upper quartile is given by the average of the observations with rank 12 and 13: \[\dfrac{[value]+[value]}{2} = [value].\] So the inter-quartile range (IQR) is \([value] - [value] = [value]\). (c) The data are somewhat asymmetric and the mean is a little larger than the median. The median and IQR might represent the bulk of the data more effectively in this case.

Exercise

The following data set which represents the numbers of days between consecutive failures in a machine (sorted into increasing order):

\(x = [value]\).

1. Find the mean and standard deviation of the above data set.
Syntax hint: Round up each answer at the final step and enter 3 decimal places. If the answer has less than 3 decimal places, then enter zero(s) at the end.
Mean: \(\bar{x} =\) .
Standard deviation: \(s =\)  .
2. Next, find the median and inter-quartile range
Syntax hint: Enter 1 decimal place. If the answer has less than 1 decimal place, then enter zero(s) at the end.
Median = .
Inter-quartile range = .
3. Which set of summary would you use to summarise the data?
Feedback: (a) The sample size is \(n = 16\), so the mean is given by \[\bar{x} = \dfrac{\sum x}{16} = [value] = [value]. \] The standard deviation is \[ s = \sqrt{\dfrac{\sum(x - \bar{x})^2}{n-1}} = \sqrt{\dfrac{\sum x^2 - n \bar{x}^2}{n-1}} = \sqrt{\dfrac{[value]}{15}} =[value].\] (b) The median is the average of the observations with rank 8 and 9, so \[ \text{Median} = \dfrac{[value]+[value]}{2} = [value].\] The lower quartile is given by the average of the observations with rank 4 and 5: \[\dfrac{[value]+[value]}{2} = [value],\] and the upper quartile is given by the average of the observations with rank 12 and 13: \[\dfrac{[value]+[value]}{2} = [value].\] So the inter-quartile range is \([value] - [value] = [value]\). (c) The mean and standard deviation have been markedly increased compared with the previous question. Here the median and inter-quartile range are preferable to the mean and standard deviation - they represent the bulk of the data much more realistically.

Exercise

A lecturer gives a science test to two classes and calculates the results as follows:

- Class \(A\) - average mark \([value]\%\)
- Class \(B\) - average mark \([value]\%\)

For each of the following questions, report your answer to the nearest percent.

1. Suppose Class \(A\) has \([value]\) students and Class \(B\) has \([value]\) students.
The average mark over the two classes = \(\%\)
Syntax hint: If the answer is, say \(30 \%\), then enter \(30\).
2. Suppose Class \(A\) has \([value]\) students and Class \(B\) has \([value]\) students.
The average mark over the two classes = \(\%\)
3. Suppose Class \(A\) and Class \(B\) have the same number of students.
The average mark over the two classes = \(\%\)
Feedback: 1. The sum of the marks of all students in Class \(A\) is \([value] \times [value] \%\). Similarly, the sum of the marks of all students in Class \(B\) is \([value] \times [value] \%\). Hence, the average mark to the nearest percent over the two classes is \[ \dfrac{[value] \times [value] \% + [value] \times [value] \%}{[value]+[value]} = [value] \%,\] which is \([value]\%\) to the nearest percent. 2. The sum of the marks of all students in Class \(A\) is \([value] \times [value] \%\). Similarly, the sum of the marks of all students in Class \(B\) is \([value] \times [value] \%\). Hence, the average mark to the nearest percent over the two classes is \[ \dfrac{[value] \times [value] \% + [value] \times [value] \%}{[value]+[value]} = [value] \%,\] which is \([value]\%\) to the nearest percent. 3. Suppose Class \(A\) has \(n\) students and so does Class \(B\). The sum of the marks of all students in Class \(A\) is \(n \times [value] \%\). Similarly, the sum of the marks of all students in Class \(B\) is \(n \times [value] \%\). Hence, the average mark over the two classes is \[ \dfrac{n \times [value] \% + n \times [value] \%}{n+n} = \dfrac{n \times ([value] \%+[value] \%)}{2n} =\dfrac{[value] \%+[value] \%}{2} = [value] \%.\] Note that the answers for (a) and (c) are the same. That is, when Class \(A\) and Class \(B\) have the same number of students, the answer is independent of the class sizes, and is given by \[ \dfrac{[value] \%+[value] \%}{2} = [value] \%.\]

Exercise

The following data give the abrasion losses, in g per hour, from fifty samples in an experiment investigating the resistance to abrasion of synthetic rubber.

[value] | [value] | [value] | [value] | [value] | [value] | [value] | [value] | [value] | [value] | [value] | [value] | [value] | [value] | [value]
[value] | [value] | [value] | [value] | [value] | [value] | [value] | [value] | [value] | [value] | [value] | [value] | [value] | [value] | [value]
[value] | [value] | [value] | [value] | [value] | [value] | [value] | [value] | [value] | [value] | [value] | [value] | [value] | [value] | [value]
[value] | [value] | [value] | [value] | [value]

Organise the data into a frequency table using the class intervals.

Abrasion loss \(x\) | Frequency
\(0 \leq x <100\) |
\(100 \leq x < 200\) |
\(200 \leq x < 300\) |
\(300 \leq x < 400\) |
\(400 \leq x < 500\) |
\(500 \leq x < 600\) |

Calculate the sample mean and standard deviation. Give your answers to 2 decimal places.

If the answer has less than 2 decimal places, then enter zero(s) at the end.

Sample mean = (g/h)

Sample standard deviation = (g/h)
Feedback: Abrasion loss \(x\) | Frequency \(0 \leq x <100\) | [value] \(100 \leq x < 200\) | [value] \(200 \leq x < 300\) | [value] \(300 \leq x < 400\) | [value] \(400 \leq x < 500\) | [value] \(500 \leq x < 600\) | [value] The sample size is \(n = [value]\). The sample mean is \( \bar{x} = \dfrac{\sum_{i=1}^n x_i}{n} = \dfrac{[value]}{[value]} = [value]\). The sample standard deviation is \(s = \sqrt{\dfrac{\sum_{i=1}^n (x_i - \bar{x})^2}{n-1}} = \sqrt{\dfrac{[value]}{[value]-1}} = \sqrt{[value]...} = [value]\) to 2 d.p. Note that the histogram representing the data is rather asymmetric, with a longer tail to the right.

Exercise

Consider the following data set of student heights. Calculate the mean, variance and standard deviation of the data.

Report each answer to 3 decimal places. If the answer has less than 3 decimal places, then enter zero(s) at the end.

[value] | [value] | [value] | [value] | [value] | [value] | [value] | [value] | [value] | [value]
[value] | [value] | [value] | [value] | [value] | [value] | [value] | [value] | [value] | [value]
[value] | [value] | [value] | [value] | [value] | [value] | [value] | [value] | [value] | [value]

1. Calculate the sample mean:
\( \bar{x} = \) .
2. Calculate the sample standard deviation following the steps below.
Step 1: Calculate \( \sum x^2 = \) .
Step 2: Use your above answers to calculate \( \sum ( x - \bar{x})^2 =\) .
Step 3: Use your answer in Step 2 to calculate the sample variance
\(s^2 =\) .
Step 4: Use your answer in Step 3 to calculate the standard deviation
\(s =\) .
Feedback: 1. \( \bar{x} = \dfrac{[value]}{[value]} = [value]... = [value]\) to 3 d.p. 2. \( \sum x^2 = [value]\). Let \(n\) denote the sample size, so \( n = [value]\). We have: \(\begin{align} \sum (x - \bar{x})^2 &= \sum x^2 - n \bar{x}^2 \\&= [value] - [value] \times ([value]...)^2 \\&= [value]... = [value] \end{align} \) to 3 d.p. \(s^2 = \dfrac{\sum (x - \bar{x})^2}{n-1} = \dfrac{[value]...}{[value]-1} = [value]... = [value]\) to 3 d.p.. \(s = \sqrt{s^2} = \sqrt{[value]...} = [value]... = [value]\) to 3 d.p. Remark: Do your calculations to a more precise degree of accuracy than what you are reporting to. This help minimise the risk of your results being numerically inaccurate because of compound rounding.

Exercise

Calculate the sample variance and sample standard deviation of the data set:

\([value]\)

Give your answers to 3 decimal places. Syntax hint: If the answer has less than 3 decimal places (e.g. \(1.1\)), then enter zero(s) at the end (e.g. \(1.100\)).

1. Sample variance: \(s^2 = \) .
2. Use your above answer to compute the sample standard deviation:
\(s = \) .
Feedback: Sample size \( n = 10\); Sample mean \( \bar{x} = \dfrac{[value]}{10} = \displaystyle [value]\); 1. Sample variance \(s^2 = \dfrac{\sum (x - \bar{x})^2}{n-1} = \dfrac{[value]}{9} = \displaystyle [value]= [value]\); 2. Sample standard deviation \(s = \sqrt{s^2} = \sqrt{\displaystyle [value]} = [value]\).

Exercise

Find the median, lower quartile, upper quartile, and inter-quartile range (IQR) for the data set: \[[value]\]

Median =

Lower quartile =

Upper quartile =

Inter-quartile range (IQR) = upper quartile \(-\) lower quartile
Feedback: We first sort \([value]\) into increasing order to obtain \[[value],\] then allocate rank to the observations. The number of observations is \(n=9\) so \(r_{2}=5\) and the median is the observation with rank 5, so median \(= [value]\). \(r_{1}=2.75\) and the lower quartile is the average of the observations with ranks 2 and 3: \(\dfrac{[value]+[value]}{2}=[value]\). \(r_{3}=7.25\) and the upper quartile is the average of the observations with ranks 7 and 8: \(\dfrac{[value]+[value]}{2}=[value]\). IQR \(= [value] - [value] = [value]\).

Exercise

The following data set gives the number of thread-breaks in each of 50 one-hour period in a spinning machine. Use these data to form a frequency table and calculate the mean of the data to 2 decimal places.

[value] | [value] | [value] | [value] | [value] | [value] | [value] | [value] | [value] | [value]
[value] | [value] | [value] | [value] | [value] | [value] | [value] | [value] | [value] | [value]
[value] | [value] | [value] | [value] | [value] | [value] | [value] | [value] | [value] | [value]
[value] | [value] | [value] | [value] | [value] | [value] | [value] | [value] | [value] | [value]
[value] | [value] | [value] | [value] | [value] | [value] | [value] | [value] | [value] | [value]

Observation \(x\) | Frequency \(f\) | Count \(fx\)
\(0\) |  | \(0\)
\(1\) |  |
\(2\) |  |
\(3\) |  |
Total |  |

Mean =
Feedback: We are given the following data set: [value] | [value] | [value] | [value] | [value] | [value] | [value] | [value] | [value] | [value] [value] | [value] | [value] | [value] | [value] | [value] | [value] | [value] | [value] | [value] [value] | [value] | [value] | [value] | [value] | [value] | [value] | [value] | [value] | [value] [value] | [value] | [value] | [value] | [value] | [value] | [value] | [value] | [value] | [value] [value] | [value] | [value] | [value] | [value] | [value] | [value] | [value] | [value] | [value] Observation \(x\) | Frequency \(f\) | Count \(fx\) \(0\) | [value] | \(0\) \(1\) | [value] | [value] \(2\) | [value] | [value] \(3\) | [value] | [value] Total | [value] | [value] Mean = \( \dfrac{\sum fx}{\sum f} = \dfrac{[value]}{[value]} = [value]\).

Exercise

The following data are the heights (to the nearest tenth of a centimetre) of a second sample of 30 students studying engineering statistics.

Organise the data into classes using class intervals \([145,150), [150,155), \ldots , [185, 190)\) and construct a frequency table of the data. Note that all the data values lie in the range \(145-190\).

[value] | [value] | [value] | [value] | [value] | [value] | [value] | [value] | [value] | [value]
[value] | [value] | [value] | [value] | [value] | [value] | [value] | [value] | [value] | [value]
[value] | [value] | [value] | [value] | [value] | [value] | [value] | [value] | [value] | [value]

Class interval (cm) | Frequency
\([145,150)\) |
\([150,155)\) |
\([155,160)\) |
\([160,165)\) |
\([165,170)\) |
\([170,175)\) |
\([175,180)\) |
\([180,185)\) |
\([185,190)\) |
Feedback: The height data are the following: [value] | [value] | [value] | [value] | [value] | [value] | [value] | [value] | [value] | [value] [value] | [value] | [value] | [value] | [value] | [value] | [value] | [value] | [value] | [value] [value] | [value] | [value] | [value] | [value] | [value] | [value] | [value] | [value] | [value] After we organise the data we get: Class interval (cm) | Frequency \([145,150)\) | [value] \([150,155)\) | [value] \([155,160)\) | [value] \([160,165)\) | [value] \([165,170)\) | [value] \([170,175)\) | [value] \([175,180)\) | [value] \([180,185)\) | [value] \([185,190)\) | [value]

Exercise

The following data represent the time spent weekly on a variety of activities by the full-time AFAB employees of an engineering company.

Hours spent on: |
Travel to and from work | \([value]\)
Paid activities in employment | \([value]\)
Personal sport and leisure activities | \([value]\)
Personal development | \([value]\)
Family activities | \([value]\)
Sleep | \([value]\)
Other | \([value]\)

We construct a pie chart showing how the AFAB employees spend their time. Note that the total number of hours spent is 168 (\(7\times 24\)). Compute the sectors angles (in degrees). Enter 1 decimal place (if the answer is a whole number e.g. \(12\) then enter \(12.0\)).

Hours spent on: |  | Sector Angle (degrees)
Travel to and from work | \([value]\) |
Paid activities in employment | \([value]\) |
Personal sport and leisure activities | \([value]\) |
Personal development | \([value]\) |
Family activities | \([value]\) |
Sleep | \([value]\) |
Other | \([value]\) |

The pie chart obtained is shown below: proportionally less time spent travelling, more on family activities etc.

[Image]
Feedback: Hours spent on: | Sector Angle (degrees) Travel to and from work | \(\dfrac{[value]}{168} \times 360 = [value]\) Paid activities in employment | \(\dfrac{[value]}{168} \times 360 = [value]\) Personal sport and leisure activities | \(\dfrac{[value]}{168} \times 360 = [value]\) Personal development | \(\dfrac{[value]}{168} \times 360 = [value]\) Family activities | \(\dfrac{[value]}{168} \times 360 = [value]\) Sleep | \(\dfrac{[value]}{168} \times 360 = [value]\) Other | \(\dfrac{[value]}{168} \times 360 = [value]\)

Example

From the frequency table (for instance, the one in the previous exercise), we can represent the data diagrammatically using a histogram. For example, from the following frequency table, we obtain the corresponding histogram shown below.

[Image]