BACK Mascot image.

FE0 1

Introduction to Probability

Every lesson so far, in one document · 2 chapters

back to the contents

Lesson 1

Introduction to Statistics

Taught

What is Statistics

Statistics gives meaning to data, or better, it is the science of drawing conclusions from data. It is used in a great many parts of life:

  1. Predicting. Using what has already happened to say something about what has not: elections, weather, the price of an asset.
  2. Contextualising. Placing a number beside the numbers that make it meaningful, which is most of what economics, politics and business reporting consists of.
  3. Gathering. Designing the collection of new data so that it can support a prediction at all. Medicine, marketing, finance and the social sciences all depend on experimental design, and without well-gathered data the other two uses are worth little.

Scrutinising a Claim

Consider a study of microplastics in bubble tea sold in the Bay Area, which reported dangerously high levels of BPA and microplastics in the drinks.

Faced with a result like this we already have ideas about where the plastic came from. Perhaps it is the straws. Perhaps it is the containers the drink is served in. Whatever the guess, it has to be scrutinised, because one possibility is always that the effect arose by chance rather than from the cause we have in mind.

Definition 1.1 (Null Hypothesis).

The null hypothesis is the claim that the pattern in the data arose by chance: that the supposed cause has no effect. A study is an attempt to gather evidence against it.

In this case the tap water used to prepare the drinks was itself already carrying a high concentration of microplastics, and tap water is used at every stage, from boiling the tapioca to making the syrup. Once that is known, the cup and the straw stop looking like the main source: the drink was made from contaminated water before it ever met a container.

Remark.

That finding was not in the headline, nor the subheadline. It appears as a passing remark inside the article. Often the detail that most changes the meaning of a result is not the one the article is written around.

Problem 1.1.

The evidence points at the tap water rather than at the cup or the straw. Describe a measurement which would settle the question, and say what it would show if the cup really were the main source. Then say why the headline is still a fair description of the result and a misleading one.

Gathering New Data

How does one gather new information to answer a hard question? In medicine two designs are standard.

  1. In an observational study the researchers watch what happens without intervening. Its aim is to find a cause and its effect as they occur naturally.
  2. In a randomised double-blind trial the researchers assign the treatment themselves, at random, and neither the patient nor the researcher knows who is receiving the drug and who the placebo. Its aim is to remove bias.

The difference in aim matters. An observational study can tell us what happens in the world as it is; a randomised trial can tell us what the treatment does, because randomisation removes the link between receiving the treatment and everything else about the patient.

A third design, familiar outside medicine, is A/B testing: users are assigned at random to group A or group B, each group is shown a different version of something, and the versions are compared on whatever response we care about. Advertising a new phone one way or another way is decided this way.

Example 1.2 (The Salk polio trial).

The 1954 trial of the Salk polio vaccine had to overcome a difficulty which had nothing to do with the vaccine. The vaccine was of the killed-virus kind, which carries a smaller risk than a live one but also, at that time, a less certain benefit, and a great many parents refused to let their children take part.

The refusal was not evenly spread. Consent to take part was more common among wealthier, more educated families, and polio incidence was higher in wealthier and more hygienic areas, since children in cleaner surroundings met the virus later, when it does more damage. So comparing children who were vaccinated with children who were not would have compared two groups differing in far more than the vaccine, and in a direction that would have made the vaccine look worse than it was.

Problem 1.2.

Consider the polio trial described above.

  1. What makes designing a trial for this vaccine difficult, beyond the medicine?
  2. How would you design one? Say which of the two designs above you would use and what your design does about the fact that consent is not evenly spread across the population.

Prediction

The third use is prediction. Given the data available to us, we want the likely outcome: how risky a stock is, what it is likely to be worth, how much of a portfolio to put in it. Much of the rest of this course is about doing that carefully.

How Statistics Goes Wrong

A statistic can be true and still mislead, if it answers a different question from the one being asked.

Example 1.3 (Two true statements).

At the trial of O. J. Simpson the defence noted that fewer than 11 in 25002500 women who are abused by their partner are later murdered by that partner. The number is correct, and it is an answer to the question “given that a woman is abused, how likely is she to be murdered by her abuser?”

That was not the question before the court. The victim had already been murdered, and the relevant figure is that about 88 out of 99 abused women who are murdered are murdered by their partner. Conditioning on what is already known changes the answer completely, and a later lesson explains why.

The second failure is one of procedure rather than arithmetic.

Definition 1.4 (pp-hacking).

pp-hacking is the practice of searching a body of data for patterns and then reporting whichever pattern is found as though it had been predicted in advance. Because a large enough search finds apparent effects in data with no effect in it, the reported finding may be a false positive produced by the search itself.

The order matters. Form the theory, then collect data to test it. Collecting data first and looking for patterns afterwards risks finding a pattern that is not there.

Problem 1.3.

What is the difference between forming a hypothesis and then collecting data, and collecting data and then forming a hypothesis? Say what goes wrong in the second order, and give an example of a claim you would distrust for this reason.

Numbers in Context

A number on its own is not informative. It becomes informative when we compare it with a baseline, and choosing the baseline is the hard part.

Is $10 billion a lot of money? As a person’s net worth, yes. As a country’s annual output, no.

To talk about a number at all we put it through three filters.

  1. What kind of number is it? Is it a rate, a percentage, a nominal amount, an average? How was it calculated, and who is reporting it?
  2. What can it be compared with? Is there a natural baseline or denominator? Can it be compared with the past? What is missing that the comparison would need?
  3. Is it plausible? Is it surprising, or is it about what we should have expected?

Example 1.5 (Traders who lose money).

A widely repeated figure is that between 95%95\% and 97%97\% of day traders lose money.

What kind of number is it? A percentage, which raises at once the question: a percentage of what? The figure traces back to a study of Taiwanese day traders, in which a trader counts as having quit after twelve consecutive months without a trade, and profitability is estimated from a model rather than observed directly. Both of those choices affect the number. Who reports it matters too: it usually reaches the reader through an investment article rather than the paper.

What can it be compared with? One comparison is with someone who put the same money into government bonds, another with someone who bought a broad index and left it alone. Neither is a like-for-like comparison, since neither involves trading at all, and both still give a usable picture of what the activity costs.

Is it plausible? For anyone who has traded, only mildly surprising.

Example 1.6 (Student loan debt).

Education Data Initiative reports that the average federal student loan debt balance is $38,375.

What kind of number is it? An average, and immediately: an average of what, over whom? Averaged over borrowers, or over the whole population? Does it include recent graduates, or people who finished twenty years ago? Does it count medical debt, or international students? Is it a poll, a survey, or a figure taken from government and banking records?

Is it representative? The state figures spread widely around it.

StateAverage borrower debt
Maryland$43,692
California$38,168
North Dakota$29,279

Source: Education Data Initiative

What can it be compared with? What the money buys, what a degree costs elsewhere in the world, the salary it leads to, the salary without it, and the interest accruing on the balance. The last of these are missing, and a debt figure without the earnings it bought is only half a comparison.

Is it plausible? Set against a well-known American university charging on the order of $71,000 a year, a lifetime balance of $38,375 is a good deal lower than one might expect, which is itself a hint that the average is being taken over a wider group than one first imagines: not only recent graduates of expensive private universities, but everyone still carrying a federal balance.

Remark.

Both of the questions asked of the average, whether it represents the population and how far the extremes lie from it, are questions about variability. We formalise it later in the course.

Problem 1.4.

In 2022 there were 42,51442{,}514 fatalities from car accidents in the United States.

  1. What kind of number is it?
  2. What can it be compared with? Give at least two baselines, and say what each one would tell you that the other would not.
  3. What would you have expected the number to be?

Ball-park Estimates

Most of the time the number we want for the baseline is not to hand. The fix is to estimate it: split the quantity into smaller pieces we can each guess at, guess each piece, and multiply. Working to the nearest power of ten keeps the arithmetic easy and is usually accurate enough to settle the question.

Example 1.7 (Food stamp fraud).

A case study describes an article reporting that fraud in the American food stamp programme is at an all-time high, costing taxpayers $70 million, and using this to argue for ending the programme.

Is $70 million a big number? Not until we know what to compare it with, and the natural comparison is the size of the programme. That figure is not in the article, so we estimate it:

budget  ≈  (people in the country)×(fraction receiving)×(dollars per recipient per year).\text{budget} \;\approx\; (\text{people in the country}) \times (\text{fraction receiving}) \times (\text{dollars per recipient per year}).

Take 300300 million people. Take one in ten receiving, by analogy with the share of the population using food banks in the UK. For the third factor take $150 a month, roughly what a single person receives on universal credit for food, so $1800 a year. Then

300,000,000×110×1800=5.4×1010,300{,}000{,}000 \times \tfrac{1}{10} \times 1800 = 5.4 \times 10^{10},

about $54 billion, which makes the reported fraud

7×1075.4×1010≈0.13%.\frac{7 \times 10^{7}}{5.4 \times 10^{10}} \approx 0.13\% .

The actual budget in 2016 was 6.75×10106.75 \times 10^{10}, so our estimate was within 20%20\% of it, and the conclusion does not depend on the difference: the fraud is a fraction of one per cent either way.

Remark.

Estimating a number from limited information this way is called a Fermi problem, after Enrico Fermi, who was fond of such questions.

Example 1.8 (Three more).

  1. Hours a year an Imperial student spends on problem sheets: (modules per term)×(hours per sheet per week)×(weeks per term)×(terms per year).(\text{modules per term}) \times (\text{hours per sheet per week}) \times (\text{weeks per term}) \times (\text{terms per year}).
  2. Money spent on university tuition in the United States each year: (number of students)×(average tuition).(\text{number of students}) \times (\text{average tuition}).
  3. The circumference of the Earth in miles. The metre was originally defined as one ten-millionth of the distance from the pole to the equator, so that distance is 10,00010{,}000 km and the circumference is 40,00040{,}000 km. At 1.61.6 km to the mile that is 25,00025{,}000 miles, against a true value of about 24,90024{,}900.

Problem 1.5.

Give a ball-park estimate for each of the following, setting out the factors you multiply and the guess you make for each.

  1. How many pet dogs are there in North America?
  2. How many hours a year does the average American spend sitting in traffic?
  3. What would it cost to pay the tuition, room and board of every Imperial undergraduate for one year? What fraction of the College endowment is that, and what would you need to know to decide whether that fraction is large?

Cost-Benefit Analysis

Ball-park estimates are most useful when a decision depends on them. Faced with a choice between XX and YY:

  1. estimate the cost of each;
  2. estimate the benefit of each;
  3. choose the more attractive;
  4. if the stakes are high, ask how robust the analysis is.

The first two steps are Fermi problems. The fourth asks which inputs we are least sure of, and whether the conclusion survives varying them.

Example 1.9 (Cutting a fleet's fuel bill).

Fuel is one of the largest operating costs of a freight company and one of the most volatile, and it drives maintenance spend, vehicle downtime and emissions liabilities with it.

You are the capital allocation lead at a mid-sized trucking firm. You have a one-off capital budget of $10 million to cut fuel costs across a fleet of 500500 trucks the company already owns, and you must choose between two options.

  1. Fleet replacement. Buy new fuel-efficient tractors to replace the oldest vehicles in the fleet. A truck delivers its efficiency gain only once it has been bought outright and put into service; there is no partial version.
  2. Retrofit and driver programme. Fit the existing trucks with aerodynamic side skirts, and install telematics which score drivers and coach them on fuel-efficient driving. Fuel burn falls appreciably when drivers follow the coaching.

Before reading on: given only what is written above, which would you choose, and why?

The benefits. Both options promise the same kinds of thing: less volatility in the fuel bill, lower operating cost, lower maintenance spend, more vehicle uptime, less exposure to emissions liabilities, and for the new tractors a resale value at the end. Quantifying all of those separately is more than the decision needs. Money saved per year captures most of it and is the one we shall use.

The costs. These also come in kinds: the money spent upfront, the driver time spent in training rather than driving, the installation or contracting work, and the telematics subscription each year. Two of those are upfront and one is annual, so we quantify cost as

cost=upfront+(yearly cost)×(years).\text{cost} = \text{upfront} + (\text{yearly cost}) \times (\text{years}).

Quantifying the benefit. First estimate what one truck burns:

100,000 km×35 L100 km=35,000 L a year,100{,}000 \text{ km} \times \frac{35 \text{ L}}{100 \text{ km}} = 35{,}000 \text{ L a year},

and at $1.20 a litre that is $42,000 of fuel per truck per year.

For the retrofit, side skirts cut burn by about 5%5\%, worth $2,100 a year. Telematics cut it by about 8%8\%, but only about 60%60\% of drivers follow the coaching, so call it 5%5\% and another $2,100. That is $4,200 saved, less the $600 annual subscription, so about $3,600 per truck per year.

For a new truck, burn falls from 3535 to 2828 L per 100100 km, a fifth less, worth $8,400 a year, and maintenance on a new truck is about $6,000 a year lower. That is about $14,400 per truck per year.

Quantifying the cost. Retrofitting costs about $3,500 per truck upfront, side skirts and telematics installation together, and $600 a year after for the subscription. A new tractor costs $150,000, against $30,000 for the old one sold, so $120,000 upfront and nothing thereafter.

The comparison. Payback is upfront cost divided by net yearly saving:

retrofit: 3,5003,600≈1 year,new truck: 120,00014,400≈8.3 years.\text{retrofit: } \frac{3{,}500}{3{,}600} \approx 1 \text{ year}, \qquad \text{new truck: } \frac{120{,}000}{14{,}400} \approx 8.3 \text{ years}.

The budget buys either of two things. Retrofitting the whole fleet costs 500×3,500=1,750,000500 \times 3{,}500 = 1{,}750{,}000 and saves 500×3,600=1,800,000500 \times 3{,}600 = 1{,}800{,}000 a year. Replacing trucks buys 8383 of them for the full 1010 million and saves 83×14,400=1,195,20083 \times 14{,}400 = 1{,}195{,}200 a year. So the retrofit saves more while spending under a fifth as much, and it leaves most of the budget unspent.

Robustness. The inputs we are least sure of are the price of diesel, the share of drivers who follow the coaching, the fleet size and the maintenance saving. Varying any of them within a plausible range does not reverse the conclusion, because the two options differ by a factor rather than a few per cent.

Problem 1.6.

Take the fleet example above over a ten-year horizon, and suppose the budget stays at $10 million.

  1. Show that no value of the driver compliance rate, however low, makes the new trucks the better choice. Say which feature of the two options makes this so.
  2. The retrofit cost of $3,500 per truck is the input a supplier could most easily change. How high would it have to go before the new trucks won? Remember that once it rises above $20,000 the budget no longer covers the whole fleet.

Exploratory Data Analysis

Much of what probability is for is saying something about a whole group when we have only seen part of it.

Definition 1.10 (Population and Sample).

The population is the entire collection of units we want to draw a conclusion about. A sample is a subset of the population which we actually observe.

Example 1.11.

Old Faithful is a geyser which erupts roughly an hour apart. Asking how faithful Old Faithful is means asking about every eruption it will ever make, from the few hundred that have been timed.

Or take an election with 100,000100{,}000 voters choosing between A and B. We cannot ask all of them. Coding a vote for A as 11 and for B as 00, a sample of 500500 voters splitting 300300 to 200200 gives some idea of how the whole electorate will divide.

Remark.

Nothing so far guarantees that what holds in the sample holds in the population. The rest of the course is about making that step safely.

Returns

Take a financial example. The monthly equity returns for Canada were recorded over 107107 months, from February 1988 to December 1996, one number per month.

 0.07  0.05  0.02 -0.04  0.08 -0.02 -0.05  0.02  0.03
 0.00  0.03  0.08 -0.03  0.01  0.03  0.01  0.02  0.08
 0.02 -0.02  0.00  0.01  0.02 -0.09  0.00  0.01 -0.07
 0.07  0.00  0.02 -0.05 -0.04 -0.03  0.03  0.04  0.00
 0.07  0.00  0.01  0.04 -0.02  0.02  0.01 -0.03  0.05
-0.02  0.00  0.01 -0.01 -0.05 -0.01  0.01  0.00  0.02
-0.02 -0.07  0.03 -0.04  0.03 -0.02  0.06  0.03  0.04
 0.01 -0.01 -0.01  0.01 -0.05  0.09 -0.02  0.05  0.06
-0.05 -0.04 -0.01  0.01 -0.06  0.05  0.06  0.02 -0.01
-0.06  0.02 -0.05  0.06  0.04  0.02  0.04  0.02  0.02
 0.00  0.00 -0.01  0.04  0.01  0.05 -0.01  0.02  0.04
 0.02 -0.03 -0.03  0.05  0.04  0.08  0.07 -0.03

A first question to ask of a column of numbers like this is where the middle is.

Scanning it, the values look as though they tend positive, and that is what we should expect. An asset whose returns averaged zero would go nowhere over the nine years, and one whose returns averaged negative would end the period worth less than it started, which is not what these equities did. So the middle is somewhere above zero. Reading a column one entry at a time is a poor way to locate it, though, and the first thing to do with data like this is draw it.

Definition 1.12 (Return).

For an asset held over a period, beginning at value BB and ending at value EE, the return over the period is

r=E−BB,r = \frac{E - B}{B},

and 1+r1 + r is the factor of return, so that E=(1+r)BE = (1+r)B.

Example 1.13.

If an asset ends the period at E=110E = 110 having returned r=0.1r = 0.1, then 110=1.1B110 = 1.1B, so B=100B = 100.

Remark.

What counts as the ending value EE depends on the asset. For a share held and sold it is the sale price, but if the share paid dividends over the period those belong in EE too, since they are part of what holding it returned.

Histograms

To see a column of numbers we plot it. The values are sorted into bins, and the number of values falling in each bin is drawn as a bar.

-0.10-0.05+0.00+0.05+0.10051015monthly returncount
Figure 1.1. The 107107 monthly Canadian equity returns, one bin per percentage point.

Reading it: the centre sits somewhere between 00 and 2%2\%, the shape is a single mound with the two tails dying away at roughly the same rate, and nothing sits far out on its own. The most common outcome is a small positive month.

Remark (A histogram is not a bar chart).

Histograms are for quantitative variables and bar charts are for categorical ones. The vertical axis of a bar chart may be anything; the vertical axis of a histogram is always a count or a frequency.

Remark.

The number of bars changes how smooth the picture looks. Too few and the shape disappears into three or four blocks; too many and every bar is a count of one or two, and the shape is lost in the noise.

Not every set of data makes a symmetric mound. A distribution is skewed to the left when its left tail is drawn out, which puts the bulk of the values on the right, and skewed to the right when the right tail is the long one.

skewed to the leftskewed to the rightlong tail on the leftlong tail on the right
Figure 1.2. The two skewed shapes. The name follows the tail, not the bulk.

The spread of the values about the centre is the variation. In the Canadian returns it could come from almost anything: credit conditions, commodity prices, a change of policy, a single piece of news. Naming the sources is not the same as measuring the spread, and measuring it is what we do later.

Data, Units and Variables

Definition 1.14 (Data, Observational Units, Variables, Distribution).

Data are the values measured, or the characteristics recorded, on the individual entities of interest.

The observational units are those individual entities on which the data are recorded.

The variables are the measured values or recorded characteristics of the observational units. A variable is quantitative if its values are numbers, such as a height or a return, and categorical if its values are labels, such as a country or a vote.

The distribution of a variable is the pattern of its values across the observational units: which are common, which are rare, and how widely they spread.

A histogram is not the only way to draw a distribution. A dot plot puts one dot per observation above its value, stacking them where values repeat, which keeps every individual observation visible in a way binning does not.

-0.10-0.05+0.00+0.05+0.10monthly return
Figure 1.3. The same Canadian returns as a dot plot, one dot per month. The tallest stack is the fifteen months returning exactly +2%+2\%.

For the example above, the observational units are the individual months, the variable is the return rr, which is quantitative, and Figures 1.1 and 1.3 are two pictures of its distribution.

Remark.

To work out what the observational units are, it helps to ask first what variables are being measured. The units are whatever each measurement is attached to.

Problem 1.7.

For each study, state the observational units and name two relevant variables, saying for each whether it is quantitative or categorical.

  1. A study of what makes pairs of college room-mates compatible.
  2. A study of the availability of vegetarian meals in the College dining halls.

Problem 1.8.

A 2003 study titled Do defaults save lives?, published in Science, investigated whether the phrasing of the sign-up question affects how many people register as organ donors. The 161161 participants filled out a fake online driver’s licence application, and were asked to sign up in one of three ways: opt-in, told the default was not being a donor; opt-out, told the default was being a donor; and neutral, not told about any default and asked to choose.

  1. What are the observational units?
  2. What are the variables, and are they quantitative or categorical?

Comparing Distributions

Put a second country beside the first. Japanese equity returns were recorded over the same 107107 months, and here is each country drawn on the axes that suit it.

-0.40-0.20+0.00+0.200510monthly return, Japancount
Figure 1.4. Japanese monthly returns, on an axis running from −0.40-0.40 to 0.300.30.
-0.20-0.10+0.00+0.10051015monthly return, Canadacount
Figure 1.5. Canadian monthly returns, on an axis running from −0.20-0.20 to 0.150.15.

Set side by side like this the two pictures say almost nothing. Both show a mound near zero of roughly the same width on the page, so the eye reports that the two countries behave alike. They do not: the horizontal axes differ by a factor of two, and the bins differ with them, so equal-looking widths on the page stand for quite different widths in returns. The vertical axes can play the same trick.

Always check the axes before comparing two histograms, and if they differ, redraw. Here are the two on one scale.

-0.20-0.10+0.00+0.10+0.20051015monthly return, Canadacount
Figure 1.6. Canadian monthly returns, redrawn on the common scale.
-0.20-0.10+0.00+0.10+0.20051015monthly return, Japancount
Figure 1.7. Japanese monthly returns, on the same scale as Figure 1.6.

Read together, the two show something a single number would not. The Canadian returns run from −9%-9\% to +9%+9\%; the Japanese run from −19%-19\% to +24%+24\%. Japan’s tails reach much further in both directions, so it offers both the larger gains and the larger losses, while Canada clusters more tightly about its centre.

Remark.

Which is better depends on what is wanted, and the histograms do not answer it. A tighter distribution carries less risk but gives up the larger gains. That trade-off is the subject of a later part of the course.

Outliers

An outlier is a value lying far from the bulk of the data. Two cohorts of sixty students were each asked how many hours a week they spend on problem sheets; here are the answers, on one pair of axes. The figures are made up for the purpose, so that the shape being discussed is unmistakable.

010203040506004812hours a week, cohort Astudents
Figure 1.8. Weekly problem-sheet hours reported by cohort A. One observational unit is one student.
010203040506004812hours a week, cohort Bstudents
Figure 1.9. The same for cohort B, on the same axes. One bar stands well clear of the rest.

The lone bar near 5656 hours in cohort B is an outlier. Everything else in that cohort lies below 2525, so a single student sits more than twice as far out as anyone around them.

Comparing the two, the general claim is available: cohort A works more, because its centre sits at larger values, near 2222 hours against cohort B’s 1414. The outlier does not disturb that claim, and it does move a summary. Cohort B’s mean is 15.015.0 hours with the outlier and 14.314.3 without it, so one student out of sixty shifts the average of the whole cohort by nearly three quarters of an hour.

An outlier is not automatically an error to be removed. It may be a mistake in recording, in which case it should go; it may be a student who genuinely works that way, in which case it is the most informative observation in the set. Deciding which requires knowing where the number came from, and that is a question about the data collection rather than about the histogram. The same applies to Japan’s two months below −16%-16\% in Figure 1.7: they sit clear of the mound, and any summary of the Japanese returns which throws them away will understate how badly a month can go.

Time Series

The returns above were collected over time, and they came in an order. A histogram throws that order away.

Definition 1.15 (Time Series).

A sequence of observations recorded over time, in the order they occurred, is a time series. Plotting the observations against time gives the time series plot.

1990199219941996-0.10-0.05+0.00+0.05+0.10monthreturn
Figure 1.10. The Canadian monthly returns against time, February 1988 to December 1996. The dashed line marks zero.

The vertical axis carries the return and the horizontal axis the time, so each point is one month and the line joins them in the order they occurred.

Problem 1.9.

Look at Figure 1.10. Do you see a pattern? Say what a run of consecutive months above zero would have to look like before you would call it one.

It is tempting to read this plot as returning towards zero after each excursion, or as being about to turn after a run in one direction. Neither is visible here. The series is close to what repeated coin tossing looks like when it is plotted, and one of the things this course does is give us the means to say what “close to” means, rather than deciding by eye.

Not every series is like that.

10012515017520019911992199319941995monthmegalitres
Figure 1.11. Monthly beer production in Australia, January 1991 to August 1995, in megalitres. The December of each year is marked.

Source: monthly beer production in Australia, 476476 monthly observations running from January 1956 to August 1995. The figure shows the last four and a half years.

Problem 1.10.

Does the series in Figure 1.11 have a pattern? If it does, say what it is, at what points the series peaks and at what points it falls, and what could produce it. The data are Australian.

The pattern repeats once a year, and knowing it changes the question to ask. The interesting thing about any single month is no longer how large it is, but how large it is beside the same month in other years, since comparing a peak month with a trough month tells us about the calendar rather than about the brewing.

Remark.

The vertical axis matters here as much as the data. A plot whose axis starts well above zero makes a small wobble look like a crisis, and one whose axis runs far past the data flattens a real movement into a straight line. Check the axes first, on your own plots as much as on other people’s.

Exercises

Exercise 1.1.

Decide whether each of the following is true or false, and support your answer with a ball-park estimate rather than a search.

  1. More than 1010 million gallons of milk are consumed in London each year.
  2. I could empty an ornamental fountain in one day using only a teaspoon.
  3. Imperial students collectively buy many thousands of textbooks each year.

Exercise 1.2.

Set up a Fermi-style calculation for the benefit and for the cost of distributing insecticide-treated mosquito nets, using the following.

  1. An unvaccinated child in sub-Saharan Africa has 11 to 33 malaria infections a year in early childhood.
  2. The infection fatality rate is about 11 death per 400400 clinical cases.
  3. A net costs $2 to manufacture, stays effective for about 33 years, and is shared by 22 people on average.
  4. People sleeping under a net are half as likely to contract malaria as those without.

Give the benefit as deaths averted per person-year and the cost as dollars per person-year.

Exercise 1.3.

Do the same for a vaccination campaign, using the following.

  1. The vaccine works best if the first dose is followed by a booster 1.51.5 years later, and children receiving both doses are 1515 to 25%25\% less likely to die of malaria. Assume children receiving only one dose see no change.
  2. Only 35%35\% of children who get one dose return for the booster, so about 44 doses are given per fully vaccinated child.
  3. A single dose costs $10, and the vaccine must be kept cold and administered by a trained professional.

Exercise 1.4.

Give the cost per death averted for each of the two programmes above. Which is the better use of a fixed budget, and by roughly what factor? Are you surprised? Say which components of your calculation you are least confident in, and whether the conclusion survives varying them.

Exercise 1.5.

Take the state figures for average student loan debt given earlier.

  1. The national average is $38,375 and California’s is $38,168. Explain why these being close does not mean California is typical.
  2. Name a number not in the table which would change your reading of the national average, and say in which direction.

Exercise 1.6.

A newspaper reports that a treatment “doubles your risk” of a disease.

  1. What kind of number is this, and what is missing?
  2. What would you need to know before deciding whether to act on it?
  3. Give a baseline risk for which the doubling would matter, and one for which it would not.

Exercise 1.7.

Sketch, by hand, the histogram you would expect for each of the following, and say whether it is roughly symmetric, skewed to the left, or skewed to the right.

  1. The heights of adults in a large city.
  2. The annual incomes of households in a large city.
  3. The marks of a cohort on an examination that most of them found easy.

Exercise 1.8.

Figure 1.1 uses one bin per percentage point, and its tallest bar is the 1515 months returning +2%+2\%.

  1. Redraw the histogram in your head with bins of 55 percentage points. How many bars are there, and what happens to the shape?
  2. Redraw it with bins of a tenth of a percentage point. What goes wrong?
  3. State in one sentence what the bin width is trading off.

Check Yourself

 

Fresh questions on the whole lesson — none of them is worked out above. Do each on paper first; the box only tells you whether you got there.

Answers are checked in your browser, as often as you like. Nothing is sent anywhere and nothing is kept but your own work. A formula may be written with the symbols themselves or with ~ & | -> <-> ^, and \and, \or, \to expand as you type.

Exercise 1.9.

The claim that a pattern in data arose by chance, and that the supposed cause has no effect, is called the

answer one of these

Exercise 1.10.

Researchers assign a treatment at random, and neither the patient nor the researcher knows who received the drug. This design is a

answer one of these

Exercise 1.11.

Searching a body of data for patterns and then reporting whichever is found as though it had been predicted is called

answer one of these

Exercise 1.12.

A histogram is the right picture for which kind of variable?

answer one of these

Exercise 1.13.

The vertical axis of a histogram is always

answer one of these

Exercise 1.14.

A distribution whose right tail is drawn out far past the bulk of its values is

answer one of these

Exercise 1.15.

The country of birth is recorded for each student in a cohort. This variable is

answer one of these

Exercise 1.16.

In the Canadian returns data, what are the observational units?

answer one of these

Exercise 1.17.

An asset begins a period at B=100B = 100 and ends it at E=120E = 120. What is the return?

answer one of these

Exercise 1.18.

An asset begins at B=50B = 50 and returns r=−0.2r = -0.2 over the period. What is EE?

answer one of these

Exercise 1.19.

Canadian monthly returns run from −9%-9\% to +9%+9\% and Japanese from −19%-19\% to +24%+24\% over the same months. Which has the greater variation?

answer one of these

Exercise 1.20.

A value lying far from the bulk of the data is called

answer one of these

Exercise 1.21.

To the nearest power of ten, how many seconds are there in a year?

answer one of these

Exercise 1.22.

Reported fraud of $70 million against a programme budget of about $54 billion is roughly

answer one of these

Exercise 1.23.

Which plot keeps the order in which the observations were recorded?

answer one of these

Lesson 2

Summarising Data

Taught

Measures of Central Tendency

Suppose we collect nn pieces of data. We need some way of describing them, and we write them as

x1,x2,x3,…,xn.x_1, x_2, x_3, \ldots, x_n .

Here x1x_1 is the first number and xnx_n the last, and nn is the number of numbers, the number of observations, also called the sample size. These are the values we observe. The letter xx is just a name for the set of numbers; we could just as easily use yy. If the data are 5,2,8,6,25, 2, 8, 6, 2, for example, then n=5n = 5, x1=5x_1 = 5 and x3=8x_3 = 8.

Sometimes the order of the observations means something. In the monthly returns of the last lesson the first observation corresponds to the first month. Sometimes it does not: in a survey each number corresponds to one respondent, and the list could be written in any order.

The Sample Mean

Definition 2.1 (Sample Mean).

The sample mean of x1,…,xnx_1, \ldots, x_n is their average,

xˉ=sumn=x1+x2+⋯+xnn.\bar{x} = \frac{\text{sum}}{n} = \frac{x_1 + x_2 + \cdots + x_n}{n} .

The symbol xˉ\bar{x} is read ”xx bar”.

There is a more compact way to write the sum x1+x2+⋯+xnx_1 + x_2 + \cdots + x_n, called summation notation:

∑i=1nxi=x1+x2+⋯+xn.\sum_{i=1}^{n} x_i = x_1 + x_2 + \cdots + x_n .

It means that for each value of ii from 11 to nn we add to the sum the value indicated, in this case xix_i. Using it,

xˉ=1n∑i=1nxi.\bar{x} = \frac{1}{n}\sum_{i=1}^{n} x_i .

For the data 5,2,8,6,25, 2, 8, 6, 2 the mean is xˉ=5+2+8+6+25=235=4.6\bar{x} = \dfrac{5 + 2 + 8 + 6 + 2}{5} = \dfrac{23}{5} = 4.6.

Example 2.2 (Summation notation).

Think of each row of this table as an observation on two variables. To make things concrete, each row is a year, and xx and yy are the annual returns on two different assets: in year 11 asset xx returned 7%7\%, and in year 44 asset yy returned 3%3\%.

year iixix_iyiy_i
110.070.070.110.11
220.060.060.050.05
330.040.040.090.09
440.030.030.030.03

The two means are

xˉ=0.07+0.06+0.04+0.034=0.204=0.05,yˉ=0.11+0.05+0.09+0.034=0.284=0.07.\bar{x} = \frac{0.07 + 0.06 + 0.04 + 0.03}{4} = \frac{0.20}{4} = 0.05, \qquad \bar{y} = \frac{0.11 + 0.05 + 0.09 + 0.03}{4} = \frac{0.28}{4} = 0.07 .

A sum need not run over all the observations. Here we sum only the second and third:

∑i=23xi=x2+x3=0.06+0.04=0.10.\sum_{i=2}^{3} x_i = x_2 + x_3 = 0.06 + 0.04 = 0.10 .

For each value of ii we can add in anything we want, such as the product of the two returns, or the distance of xix_i from its mean:

∑i=14xiyi=0.0077+0.0030+0.0036+0.0009=0.0152,∑i=14(xi−xˉ)=0.02+0.01−0.01−0.02=0.\sum_{i=1}^{4} x_i y_i = 0.0077 + 0.0030 + 0.0036 + 0.0009 = 0.0152, \qquad \sum_{i=1}^{4} (x_i - \bar{x}) = 0.02 + 0.01 - 0.01 - 0.02 = 0 .

We think of the mean as the centre of the data. In a class survey of how many beers students claim they can drink, one answer was deleted because nobody believed it. Among the rest, the women claimed on average that they could drink 4.24.2 beers and the men 7.97.9, so in this sense the men claim to drink more.

For the equity returns of the last lesson the means are

xˉCanada=0.00907,xˉJapan=0.00234.\bar{x}_{\text{Canada}} = 0.00907, \qquad \bar{x}_{\text{Japan}} = 0.00234 .

This is a big difference: about 0.9%0.9\% a month against about 0.2%0.2\%. It was hard to see in the histograms, because it is small compared with the variation of the returns.

Problem 2.1.

For the returns in the table above, compute ∑i=14yi2\displaystyle\sum_{i=1}^{4} y_i^2, ∑i=34(xi+yi)\displaystyle\sum_{i=3}^{4} (x_i + y_i) and ∑i=14(yi−yˉ)\displaystyle\sum_{i=1}^{4} (y_i - \bar{y}).

The Median

Definition 2.3 (Median).

After the data have been put in order, the median is the middle value. If there is an even number of observations, the median is the average of the two middle values.

So the median of 1,2,3,4,51, 2, 3, 4, 5 is 33, and the median of 1,1,2,3,4,51, 1, 2, 3, 4, 5 is 2+32=2.5\dfrac{2 + 3}{2} = 2.5.

Mean versus Median

The mean and the median are both good measures of the centre of a distribution, but the median is much less sensitive to extreme values. It depends only on which observations sit in the middle of the ordering, so making the largest value larger, or the smallest smaller, leaves it unchanged.

datameanmedian
1,2,3,4,51, 2, 3, 4, 53333
1,2,3,4,1001, 2, 3, 4, 100222233

Extreme values like the 100100 are the outliers of the last lesson. We used to call them funny points, but outliers sounds more scientific. Outliers are sometimes the most interesting aspect of a data set, and sometimes they are just coding errors.

Example 2.4 (A sex survey).

In the 2004 American Sex Survey, a random-sample telephone poll of 1,5011{,}501 adults, women reported a median of 33 sex partners in their lifetimes and men a median of 88. The means were far larger: an average of 66 partners for women and 2020 for men. The report explains that the averages are higher because a small number of individuals, especially men, report a very large number of partners. Whether those answers are true or boasts, a handful of them moves the mean a long way and the median hardly at all.

Source: ABC News, American Sex Survey

The Mode

Definition 2.5 (Mode).

The mode of a data set is the value that appears most frequently, the highest point of its histogram.

People also use the word more loosely, calling any lump in a histogram a mode.

Measures of Dispersion

The mean and the median locate the centre of a set of observations, for different notions of centre. They do not measure its dispersion, or spread. Are most of the observations close to the centre, or not? What is the typical range the data fall into? The data sets 5,5,5,5,55, 5, 5, 5, 5 and 1,3,5,8,81, 3, 5, 8, 8 both have mean 55, but the second is clearly the more variable.

Often we care about the variability as well as the centre.

  1. Medicine: we may know the average life expectancy given a diagnosis, but what are the best and the worst cases?
  2. Exams: we may know the class average and our own score, but how do we really compare with the rest of the class?
  3. Investments: we may know the historical average annual return of a stock or a mutual fund, but is a big loss possible? Beside the average return we need a measure of risk.

Example 2.6 (Daily temperatures in two cities).

Figure 2.1 shows the daily mean temperatures in Seattle and in Chicago over 2024 and 2025, drawn on the same scale. The means of the two cities are very close, 11.711.7 °C and 11.211.2 °C, but the distributions are very different: the temperature in Chicago is far more variable.

Source: Open-Meteo historical weather API, ERA5 reanalysis, daily mean temperature at 22 metres for Seattle and Chicago, 1 January 2024 to 31 December 2025, 731731 days each.

mean 11.7 °C−20−10010203001020304050daily mean temperature (°C)daysSeattlemean 11.2 °C−20−10010203001020304050daily mean temperature (°C)daysChicago
Figure 2.1. Daily mean temperatures in Seattle and Chicago, 2024–2025, in one-degree bins. The dashed lines mark the means.

Example 2.7 (Two share prices).

Figure 2.2 shows the daily closing prices of Tesla (TSLA) and Visa (V) shares over five years. Again the means are very close, $247.34 and $248.20, but the Tesla price is clearly more variable.

Source: Yahoo Finance daily closing prices, 1 September 2020 to 29 August 2025, 1,2551{,}255 trading days, adjusted for share splits.

mean 247.34 dollars100150200250300350400450050100150daily closing price (US dollars)daysTesla (TSLA)mean 248.20 dollars100150200250300350400450050100150daily closing price (US dollars)daysVisa (V)
Figure 2.2. Daily closing prices of Tesla and Visa shares, September 2020 to August 2025, in bins of ten dollars. The dashed lines mark the means.

Problem 2.2.

In both examples the two distributions have almost the same mean but very different spreads. Suggest a single number that could measure the spread of a set of data.

The Variance

The basic idea is to view variability in terms of the distance between each observation and the mean, xi−xˉx_i - \bar{x}. Figure 2.3 shows these distances for the two small sets of returns in the table above: overall, the distances for yy are bigger than those for xx.

xy0.0300.0450.0600.0750.0900.105
Figure 2.3. The four xx returns and the four yy returns on one scale. The vertical bars mark the means, and the horizontal bars run from each mean to the observations, so their lengths are the distances xi−xˉx_i - \bar{x} and yi−yˉy_i - \bar{y}.

We need an overall measure of how big the distances are, one number as the mean is one number. We cannot just add the distances up, because the negative distances cancel the positive ones and the sum is always zero:

∑i=1n(xi−xˉ)=∑i=1nxi−nxˉ=nxˉ−nxˉ=0.\sum_{i=1}^{n} (x_i - \bar{x}) = \sum_{i=1}^{n} x_i - n\bar{x} = n\bar{x} - n\bar{x} = 0 .

Instead we square the distances, which makes them all positive, and average them.

Definition 2.8 (Variance).

The variance of x1,…,xnx_1, \ldots, x_n is the average squared distance from the mean,

σx2=1n∑i=1n(xi−xˉ)2.\sigma_x^2 = \frac{1}{n}\sum_{i=1}^{n} (x_i - \bar{x})^2 .

Example 2.9 (The heights of a rowing crew).

The eight rowers of a crew are 182182, 185185, 188188, 190190, 191191, 193193, 195195 and 196196 cm tall (constructed data). Their mean height is xˉ=15208=190\bar{x} = \dfrac{1520}{8} = 190 cm, and

xix_i182182185185188188190190191191193193195195196196
xi−xˉx_i - \bar{x}−8-8−5-5−2-20011335566
(xi−xˉ)2(x_i - \bar{x})^2646425254400119925253636

so the variance is

σx2=64+25+4+0+1+9+25+368=1648=20.5 cm2.\sigma_x^2 = \frac{64 + 25 + 4 + 0 + 1 + 9 + 25 + 36}{8} = \frac{164}{8} = 20.5\ \text{cm}^2 .

The heights are in centimetres, so the variance is in square centimetres.

The Sample Variance

Definition 2.10 (Sample Variance).

The sample variance of x1,…,xnx_1, \ldots, x_n is

sx2=1n−1∑i=1n(xi−xˉ)2.s_x^2 = \frac{1}{n - 1}\sum_{i=1}^{n} (x_i - \bar{x})^2 .

We use n−1n - 1 instead of nn for technical reasons, to do with using a sample to estimate the variability of the population it came from, and the intuition does not change: we still think of sx2s_x^2 as the average squared distance of the observations from their mean. For large nn the two versions are almost equal. In this lesson σx2\sigma_x^2, with divisor nn, is called the variance and sx2s_x^2, with divisor n−1n - 1, the sample variance. Statistical software usually reports the sample version.

Problem 2.3.

  1. What is the smallest value a variance can take, and for what data does it take it?
  2. What are the units of the variance of a set of heights measured in metres, and of a set of monthly returns?

The Standard Deviation

It is helpful to have a measure of spread in the original units of the data. If the data have units uu, the variance has units u2u^2, which cannot be compared with the data or with the mean. The standard deviation solves this problem.

Definition 2.11 (Standard Deviation).

The standard deviation is the square root of the variance, σx=σx2\sigma_x = \sqrt{\sigma_x^2}, and the sample standard deviation is the square root of the sample variance, sx=sx2s_x = \sqrt{s_x^2}. Both have the same units as the data.

So if we want a measure of variability that can be compared with the mean, we should use the standard deviation rather than the variance. For the rowers, σx=20.5=4.53\sigma_x = \sqrt{20.5} = 4.53 cm.

Example 2.12 (Two small sets of returns).

For the returns in the table of the last chapter, the distances from the means are

xi−xˉ=0.02, 0.01, −0.01, −0.02,yi−yˉ=0.04, −0.02, 0.02, −0.04,x_i - \bar{x} = 0.02,\ 0.01,\ -0.01,\ -0.02, \qquad y_i - \bar{y} = 0.04,\ -0.02,\ 0.02,\ -0.04,

so

sx2=0.0004+0.0001+0.0001+0.00043=0.00103,sx=0.0183,sy2=0.0016+0.0004+0.0004+0.00163=0.00403,sy=0.0365.\begin{aligned} s_x^2 &= \frac{0.0004 + 0.0001 + 0.0001 + 0.0004}{3} = \frac{0.0010}{3}, & s_x &= 0.0183, \\ s_y^2 &= \frac{0.0016 + 0.0004 + 0.0004 + 0.0016}{3} = \frac{0.0040}{3}, & s_y &= 0.0365 . \end{aligned}

The sample standard deviation of the yy data is bigger than that of the xx data. This numerically captures the fact, visible in Figure 2.3, that yy has more variation about its mean than xx.

For the equity returns of the last lesson,

countrynnmeansample standard deviation
Canada1071070.009070.009070.038330.03833
Japan1071070.002340.002340.073680.07368

and the standard deviations measure the greater spread in the Japanese returns which the histograms showed.

We now have two numerical summaries of a set of data: xˉ\bar{x}, which says where the data are, and sxs_x, which says how spread out, how variable, they are. The mean is easy to interpret, as a sort of centre of the data. We know that the bigger sxs_x is, the more variable the data are, but how do we really interpret the number? What is a big sxs_x, and what is a small one?

Variability and Risk

Example 2.13 (A gift or a gamble).

Suppose someone offers a choice between a gift of $100 and the chance to flip a fair coin for $300. We can think of the outcomes in each case as the data points of a distribution. The first is a distribution with exactly one data point, $100. The second has two data points, $0 for tails and $300 for heads. For the coin flip, in dollars,

xˉ=0+3002=150,σx2=(0−150)2+(300−150)22=22,500,σx=150.\bar{x} = \frac{0 + 300}{2} = 150, \qquad \sigma_x^2 = \frac{(0 - 150)^2 + (300 - 150)^2}{2} = 22{,}500, \qquad \sigma_x = 150 .
choicemeanstandard deviation
gift$100$0
coin flip$150$150

The gamble has the larger mean, and a standard deviation as large as its mean, which measures its risk. Which to choose depends on how much that risk matters to us.

For the temperatures of Figure 2.1,

citymean temperaturestandard deviation
Seattle11.711.7 °C5.65.6 °C
Chicago11.211.2 °C10.710.7 °C

and the standard deviation of the temperature in Chicago is about twice that in Seattle. For the share prices of Figure 2.2,

sharemean pricestandard deviation
Tesla$247.34$66.78
Visa$248.20$47.37

The standard deviation of the Tesla price is about 27%27\% of its mean, and that of the Visa price about 19%19\%.

Remark.

The ratio of the standard deviation to the mean only makes sense as a measure of variability for data which cannot be negative. For data such as returns, which take both signs, the mean can be close to zero however large the spread.

The Standard Deviation and Outliers

Sometimes the standard deviation is large because of one outlier.

Example 2.14 (Attendance at tutorials).

The five tutorial groups of a course had these attendances one week (constructed data).

groupABCDE
attendance202066272725252121

The mean is xˉ=995=19.8\bar{x} = \dfrac{99}{5} = 19.8, and

σx2=0.22+13.82+7.22+5.22+1.225=270.85=54.16,σx=7.4.\sigma_x^2 = \frac{0.2^2 + 13.8^2 + 7.2^2 + 5.2^2 + 1.2^2}{5} = \frac{270.8}{5} = 54.16, \qquad \sigma_x = 7.4 .

If we remove the outlier, group B, the mean becomes 934=23.25\dfrac{93}{4} = 23.25 and

σx2=3.252+3.752+1.752+2.2524=32.754=8.19,σx=2.9.\sigma_x^2 = \frac{3.25^2 + 3.75^2 + 1.75^2 + 2.25^2}{4} = \frac{32.75}{4} = 8.19, \qquad \sigma_x = 2.9 .

One unusual group makes the standard deviation more than twice as large.

Problem 2.4.

Is the standard deviation a satisfying measure of variability? What is it conveying, and what is it not conveying?

Because it squares the distances, the standard deviation can be made large by the influence of a few outliers, so it can be a pessimistic notion of variability.

Chebyshev’s Inequality

There is a guarantee which says how most observations sit relative to the standard deviation. It is called Chebyshev’s inequality: for any k>1k > 1,

at most a fraction 1k2 of the observations are more than k standard deviations from the mean.\text{at most a fraction } \frac{1}{k^2} \text{ of the observations are more than } k \text{ standard deviations from the mean.}

Equivalently, at least a fraction 1−1k21 - \dfrac{1}{k^2} of them lie within kk standard deviations of the mean. With k=2k = 2, for example, at least 1−14=75%1 - \frac14 = 75\% of the observations are no more than two standard deviations from the mean, whatever the data.

The reason is short. Suppose that a fraction ff of the nn observations lie more than kσxk\sigma_x from the mean, and that there is at least one of them. Each of these fnfn observations contributes more than k2σx2k^2\sigma_x^2 to the sum of the squared distances, and no term of the sum is negative, so

nσx2=∑i=1n(xi−xˉ)2>fn⋅k2σx2.n\sigma_x^2 = \sum_{i=1}^{n} (x_i - \bar{x})^2 > fn \cdot k^2\sigma_x^2 .

Dividing both sides by nk2σx2nk^2\sigma_x^2 gives f<1k2f < \dfrac{1}{k^2}. The sample standard deviation is at least as large as σx\sigma_x, so the guarantee holds for sxs_x as well.

The Standard Deviation Can Overestimate Variability

We know for sure that at least 75%75\% of the observations lie in the window xˉ±2σx\bar{x} \pm 2\sigma_x. Very often the truth is far better than that. In Figure 2.4 almost all the days in each city, about 97%97\%, are within two standard deviations of the mean, and about 64%64\% are within one standard deviation. In such cases the width of the window xˉ±2σx\bar{x} \pm 2\sigma_x gives, qualitatively, an overestimate of the variability.

−20−10010203001020304050daily mean temperature (°C)daysSeattle: 63.7% within one standard deviation, 97.7% within two−20−10010203001020304050daily mean temperature (°C)daysChicago: 64.0% within one standard deviation, 96.9% within two
Figure 2.4. The temperatures of Figure 2.1 with dotted lines one standard deviation either side of the mean and dashed lines two standard deviations either side.

The Empirical Rule

For data whose histogram is a single roughly symmetric mound, a much sharper statement is usually close to the truth.

Definition 2.15 (Empirical Rule).

For mound-shaped data,

  1. approximately 68%68\% of the data lie in the interval (xˉ−sx,xˉ+sx)=xˉ±sx(\bar{x} - s_x, \bar{x} + s_x) = \bar{x} \pm s_x;
  2. approximately 95%95\% of the data lie in the interval (xˉ−2sx,xˉ+2sx)=xˉ±2sx(\bar{x} - 2s_x, \bar{x} + 2s_x) = \bar{x} \pm 2s_x.

The empirical rule helps us understand sxs_x and relate the two summaries back to the histogram. For the Canadian returns, xˉ=0.00907\bar{x} = 0.00907 and sx=0.03833s_x = 0.03833, so

xˉ±sx=(−0.02926, 0.04740),xˉ±2sx=(−0.06759, 0.08573).\bar{x} \pm s_x = (-0.02926,\ 0.04740), \qquad \bar{x} \pm 2s_x = (-0.06759,\ 0.08573) .

The empirical rule says that roughly 68%68\% of the observations are between the dotted lines of Figure 2.5 and roughly 95%95\% between the dashed lines. Counting, 6767 of the 107107 returns, 63%63\%, lie within one standard deviation of the mean and 103103, 96%96\%, lie within two. That looks reasonable.

x̄ − 2sx̄ + 2sx̄ − sx̄ + s−0.10−0.050.000.050.10051015monthly returncount
Figure 2.5. The Canadian monthly returns with the mean (solid), xˉ±sx\bar{x} \pm s_x (dotted) and xˉ±2sx\bar{x} \pm 2s_x (dashed).

The same thing can be seen from the time series plot in Figure 2.6. Five per cent of the 107107 observations outside the dashed lines would be about 55 points; there are 44 points outside, which is pretty close.

198919901991199219931994199519961997−0.10−0.050.000.050.10monthreturn
Figure 2.6. The Canadian monthly returns as a time series, with the mean and the lines xˉ±2sx\bar{x} \pm 2s_x. The four months outside are highlighted.

Remark.

Chebyshev’s inequality holds for any data at all; the empirical rule is only an approximation, and only for mound-shaped data. For the temperatures of Figure 2.4, whose histograms are not single symmetric mounds, the proportions within one and two standard deviations still happen to be close to 68%68\% and 95%95\%.

Quantiles

Quantiles tell us what fraction of the data falls in each range, which gives a more complete picture of variability.

Definition 2.16 (Quantiles).

The qq-quantiles of a set of data are the q−1q - 1 numbers which divide the ordered data into qq groups of equal size. The 1010-quantiles are the deciles, the 44-quantiles the quartiles and the 100100-quantiles the percentiles. The median is the 22-quantile.

−20−100102030010203040Chicago daily mean temperature (°C)days
Figure 2.7. The deciles of Chicago’s daily temperatures. Each of the ten groups between neighbouring dashed lines, or beyond the outermost, contains a tenth of the days.

We can measure variability by the distance between two quantiles, the width of the window they make. For example, the distance from the 1010th percentile to the 9090th:

citymeanstandard deviation1010th percentile9090th percentile1010–9090 window
Seattle11.711.7 °C5.65.6 °C4.74.7 °C19.419.4 °C14.714.7 °C
Chicago11.211.2 °C10.710.7 °C−2.5-2.5 °C24.024.0 °C26.526.5 °C

The quantiles tell us exactly what percentage of the data fall in a range. Here 80%80\% of the days fall between the 1010th and 9090th percentiles, because 10%10\% of the days lie below the 1010th percentile and 10%10\% above the 9090th. So in each city we can reasonably expect the temperature to be in the window on 80%80\% of days, and the width of the window is a measure of the variability. The quantiles also give us a better sense of the shape of the distribution, because they show where the data are packed tightly and where they are thin.

Remark.

When the 10%10\% point falls between two observations, different books and programs choose the percentile slightly differently, for instance by taking one of the two neighbours or by interpolating between them. For large data sets the choice makes little difference; the percentiles here are interpolated.

Problem 2.5.

How does the information we get from the standard deviation differ from the information we get from the quantiles?

Comparing Assets

We can use means and standard deviations to compare investments. For nine mutual funds and other assets, over the same 180180 months, the means and sample standard deviations of the monthly returns are these.

assetnnmeanstandard deviation
drefus1801800.006770.006770.047240.04724
fidel1801800.004700.004700.056590.05659
keystne1801800.006540.006540.084240.08424
Putnminc1801800.005520.005520.030080.03008
scudinc1801800.004430.004430.035970.03597
windsor1801800.010020.010020.048640.04864
eqmrkt1801800.010820.010820.068560.06856
valmrkt1801800.006810.006810.048000.04800
tbill1801800.005980.005980.002520.00252

Plotting the means against the standard deviations puts all nine on one picture, Figure 2.8. It is considered good to have a large mean return and a small standard deviation, so the best assets are towards the top left. Treasury bills have almost no variability, and keystne has the largest standard deviation without a larger mean to show for it.

drefusfidelkeystnePutnmincscudincwindsoreqmrktvalmrkttbill0.000.020.040.060.080.0040.0060.0080.010standard deviation of monthly returnmean monthly return
Figure 2.8. Mean monthly return against standard deviation for nine assets.

The same picture compares countries, here from the monthly returns of 19881988 to 19961996.

AustraliaBelgiumCanadaFinlandFranceGermanyHong KongItalyJapanUSASingapore0.030.040.050.060.070.080.0000.0050.0100.0150.020standard deviation of monthly returnmean monthly return
Figure 2.9. Mean monthly return against standard deviation for eleven countries, February 1988 to December 1996.

When the Mean Misleads

The Mean Is Often Good

The mean is one proxy for the centre of a distribution, and it is common to treat the centre as the typical value. In some cases this is reasonable.

Example 2.17 (Repeated experiments).

We carry out nn independent experiments to measure the value of a fixed, bounded quantity μ\mu, such as

  1. the average concentration of microplastics in the London water supply;
  2. the plasticity of a protein;
  3. the fraction of students who think a hot dog is a sandwich.

Because of natural variation and measurement error, each experiment gives a possibly noisy measurement of μ\mu. In such an experiment the mean of the measurements is likely to be very close to μ\mu, as long as nn is large enough; this is the law of large numbers.

But many kinds of data we meet are not like this. The features of a data set which can throw off the mean as a measure of the typical value are

  1. multimodal data;
  2. skewed and heavy-tailed distributions;
  3. outliers;
  4. high variability.

Multimodal Data

A common intuition is that the mean is roughly where the mode is. In some cases, like the repeated experiments, this is true. But sometimes a data set is naturally multimodal.

Example 2.18 (The body mass of penguins).

The top histogram of Figure 2.10 shows the body masses of 342342 penguins of three species recorded near Palmer Station in Antarctica. There are two lumps. Many data sets like this one can be decomposed into natural subsets: here the Adélie and Chinstrap penguins, 219219 birds with mean mass 3,7113{,}711 g, and the Gentoo penguins, 123123 birds with mean mass 5,0765{,}076 g. Within each subset there is only one mode, and within the subset the mean and the mode match.

Source: Palmer Station penguin data, Gorman, Williams and Fraser (2014), in the palmerpenguins data set; the 342342 penguins with body mass and bill measurements recorded.

3,0003,5004,0004,5005,0005,5006,0006,50001020body mass (g)penguinsall 342 penguinsAdélie and Chinstrap, mean 3,711 gGentoo, mean 5,076 g3,0003,5004,0004,5005,0005,5006,0006,50001020body mass (g)penguinsGentoo penguins highlighted
Figure 2.10. The body masses of 342342 penguins in bins of 100100 g, first all together and then with the Gentoo penguins highlighted.

In a multimodal data set the mean of the whole data set lies between the means of the different modes, and then it is not representative of a typical observation. The mean mass of all 342342 penguins is 4,2024{,}202 g, which is heavier than 85%85\% of the Adélie and Chinstrap penguins and lighter than 95%95\% of the Gentoos: a typical penguin of neither kind.

The same happens when we split the penguins by sex, in Figure 2.11. The mean for the entire data set is on the large end for a female, heavier than 68%68\% of the females, and on the small end for a male, lighter than 55%55\% of the males.

mean of all penguins 4,202 gfemale mean 3,862 g3,0003,5004,0004,5005,0005,5006,0006,500051015body mass (g)penguinsfemale penguinsmean of all penguins 4,202 gmale mean 4,546 g3,0003,5004,0004,5005,0005,5006,0006,500051015body mass (g)penguinsmale penguins
Figure 2.11. Body masses of the female and male penguins on the same scale, with the mean of all penguins and the mean of each sex.

Problem 2.6.

  1. Should the median of a multimodal data set be influenced by the multiple modes?
  2. Should its quantiles?
  3. Should its standard deviation?

All three are influenced, in the sense that the median, quantiles and standard deviation of the aggregate data do not reflect what is going on within the separate modes.

Why It Matters

Many times the mean and other summary statistics are used to make decisions. When the decisions are based on statistics of all the data, instead of mode by mode, they might not be the right decisions for everyone.

Example 2.19 (The duration of symptoms).

A medical researcher at a hospital records how long 100100 patients experience the symptoms of a new disease (constructed data). The average duration is 2020 days, and the histogram at the top of Figure 2.12 does not look obviously multimodal. But suppose the researcher analyses separately the 6060 patients without hypertension and the 4040 with it. The average duration is 1414 days for the patients without hypertension and 2929 days for those with it. Advice built on 2020 days would ask most patients without hypertension to wait too long, and tell most patients with hypertension to expect their symptoms to end too soon.

mean 20 days05101520253035404502468duration of symptoms (days)patientsall 100 patientsno hypertension, mean 14hypertension, mean 2905101520253035404502468duration of symptoms (days)patientspatients with hypertension highlighted
Figure 2.12. The durations of symptoms of 100100 patients, first all together and then with the patients who have hypertension highlighted.

Problem 2.7.

Cheng et al. study the time from exposure to the onset of COVID-19 symptoms. Could such data be multimodal? Suppose recommendations for how long to isolate after close contact are based on the distribution of this time. In what sense is that problematic, and what trade-offs have to be made?

Misleading Means in the Media

The American Medical Association reports that the average American consumes about 3,4003{,}400 milligrams of sodium a day, against a recommended limit of 2,3002{,}300 milligrams.

Problem 2.8.

Is the figure of 3,4003{,}400 mg representative of most people? Could the data be multimodal? Is there a lot of variability?

A closer look comes from a national study which estimated sodium intake from 2424-hour urine samples. It found a mean of 4,2054{,}205 mg a day for men and 3,0393{,}039 mg for women, and that on a given day 75.1%75.1\% of adults, 83.5%83.5\% of men and 67.1%67.1\% of women, consumed at least the recommended 2,3002{,}300 mg. So

  1. the data are multimodal: men and women consume quite different amounts on average;
  2. the variability is limited, in the sense that three adults in four are above the recommended amount.

The conclusion that Americans eat more salt than the medical community suggests they should is still valid, but a single figure of 3,4003{,}400 mg describes neither men nor women well.

Source: American Medical Association, What doctors wish patients knew about sodium consumption; Cogswell et al., Estimated 24-hour urinary sodium and potassium excretion in US adults, JAMA (2018).

Skew

Even when a distribution has only one mode, it can be skewed: its histogram stretches out to the left or to the right. There are several quantitative measures of skewness, and only the concept matters here. The stretched-out part looks like a tail, so a skewed distribution is sometimes also said to be heavy-tailed.

Right Skew

Types of data which tend to be skewed to the right are

  1. incomes, GDP, the number of awards won, and views or clicks online, where the rich get richer;
  2. waiting times, such as the time between earthquakes or volcanic eruptions;
  3. the sizes of some natural objects, such as lakes, rocks and mineral deposits.

If a distribution is skewed to the right, then typically the median and the mode are smaller than the mean.

Example 2.20 (GDP).

In 2000 the 204204 countries with a recorded GDP had a mean GDP of $164.7 billion and a median of only $7.9 billion. A few enormous economies pull the mean far to the right of where almost every country lies, as Figure 2.13 shows.

Source: World Bank, GDP (current US$), indicator NY.GDP.MKTP.CD, individual countries only.

median 7.9 bnmean 164.7 bn7 countries above 1,000 bn not shown02004006008001,0000255075100125GDP in 2000 (billions of US dollars)countries
Figure 2.13. GDP of the countries of the world in 2000, in bins of 2525 billion dollars, with the median and the mean.

Left Skew

Types of data which tend to be skewed to the left are the age at death and exam scores. If a distribution is skewed to the left, then typically the median and the mode are larger than the mean.

Example 2.21 (Exam scores).

The 4040 scores of a class on an exam (constructed data) pile up between 8080 and 100100, with a tail of weaker scripts down to 3838. The mean is 80.380.3 and the median is 84.584.5.

mean 80.3median 84.540506070809010002468exam scorestudents
Figure 2.14. Forty exam scores in bins of five marks, with the mean and the median.

Measuring Skew

The gap between the mean and the median is one quantitative measure of skew. It is positive for the GDP data, which are skewed to the right, and negative for the exam scores, which are skewed to the left.

Outliers

Outliers, abnormally large or small values, can move the mean away from the median or the mode. Outliers and skew are related, since outliers do skew the distribution; the distinction is usually that we think of outliers as anomalies, whereas skew can be a natural property of the data.

Example 2.22 (Time on social media).

A class survey asked “How many minutes per day do you spend on social media?” (constructed data). Twenty students answered between 1010 and 240240 minutes, and one replied 1818 hours, that is 1,0801{,}080 minutes. This is an outlier.

statisticwith the outlierwithout the outlier
mean125.5125.5 min77.877.8 min
standard deviation220.7220.7 min57.657.6 min
median6060 min6060 min

The standard deviations use divisor nn. The one answer moves the mean by nearly 5050 minutes and multiplies the standard deviation by almost four, and it does not move the median at all.

18 hours01202403604806007208409601,0800246minutes per day on social mediastudents
Figure 2.15. Twenty-one answers for time spent on social media, in half-hour bins, with the outlier highlighted.

The tutorial attendances earlier showed the same effect of an outlier on the standard deviation.

High Variability

If the variability of a data set is high, then neither the mean nor the median is representative of a typical observation.

Example 2.23 (Hours of study).

A survey asked 3030 students “How many hours per week do you spend studying?” (constructed data). The mean, 14.514.5 hours, and the median, 1212 hours, are pretty close. But the answers run from 11 to 3030 hours with a standard deviation of 8.58.5 hours, so neither 14.514.5 nor 1212 can be taken as the answer of a typical student.

mean 14.5median 1204812162024283201234hours of study per weekstudents
Figure 2.16. Thirty answers for hours of study per week, in two-hour bins, with the mean and the median.

Gambling gives another situation where the mean is not necessarily representative. When we flip a fair coin for $300, the mean outcome is $150, but the outcome is either $0 or $300, and neither is anything like the mean.

A Robust Measure of Variability

If the standard deviation is so easily inflated by outliers and heavy tails, what should we use instead? Quantile widths are much more robust to outliers. In the social media survey, the window from the 1010th to the 9090th percentile is 133.5133.5 minutes wide without the outlier and 160160 minutes wide with it, while the standard deviation jumps from 57.657.6 to 220.7220.7 minutes.

Relating Two Variables

The mean and the standard deviation summarise a set of numbers which are measurements of just one thing, one variable. A different question is how one thing relates to another. Often each observation contains measurements of several variables:

  1. medical records: age, weight, blood pressure;
  2. property sales: price, floor area;
  3. the penguins: flipper length, body mass, bill length.

We often want to know whether two variables are positively or negatively associated. When we examine two variables at a time, the scatter plot is the main graphical tool, and covariance and correlation are the main numerical summaries.

Scatter Plots

Example 2.24 (Beer and weight).

In the class survey of how many beers students claim they can drink, each student also gave their weight in pounds. The first ten answers are these.

student ii1122334455667788991010
beers12121212555577131344121212121212
weight192192160160155155120120150150175175100100165165165165150150

Now we think of each pair of numbers as an observation. Each pair corresponds to a person, with two numbers associated with them, the number of beers and the weight, and each pair corresponds to a point on the plot. Is the number of beers you can drink related to your weight?

100120140160180200051015weight (pounds)number of beers
Figure 2.17. Claimed number of beers against weight for the ten students in the table.

In general the data look like nn pairs, and the iith observation is a pair of numbers (xi,yi)(x_i, y_i). The plot enables us to see the relationship between xx and yy. As another example, we could plot the monthly returns on the windsor mutual fund against the returns on the market as a whole, valmrkt, with each point a month, to ask whether the returns on a fund are related to the market’s.

In both examples there does seem to be a relationship. Even more, the relationship looks linear, in that we could draw a line through the plot to capture the pattern. Covariance and correlation summarise how strong a linear relationship there is between two variables.

Covariance and Correlation

Definition 2.25 (Sample Covariance and Sample Correlation).

The sample covariance between xx and yy is

sxy=1n−1∑i=1n(xi−xˉ)(yi−yˉ).s_{xy} = \frac{1}{n - 1}\sum_{i=1}^{n} (x_i - \bar{x})(y_i - \bar{y}) .

The sample correlation between xx and yy is the covariance divided by the two standard deviations,

rxy=sxysxsy.r_{xy} = \frac{s_{xy}}{s_x s_y} .

The correlation is always a number between −1-1 and 11:

−1⩽rxy⩽1.-1 \leqslant r_{xy} \leqslant 1 .
  1. The closer rr is to 11, the stronger the linear relationship with a positive slope: when one variable goes up, the other tends to go up.
  2. The closer rr is to −1-1, the stronger the linear relationship with a negative slope: when one goes up, the other tends to go down.

The correlation between windsor and valmrkt is 0.9230.923, and over the whole beer survey the correlation between the number of beers and weight is 0.6920.692 (for the ten students in the table alone it is 0.790.79). The larger correlation between windsor and valmrkt indicates that their linear relationship is the stronger one. Figure 2.18 shows some more examples.

r = 1.000r = −1.000r = 0.049r = 0.790r = −0.983r = −0.127
Figure 2.18. Six constructed scatter plots of 100100 points with their correlations. The last is a parabola, y=12x2y = \frac12 x^2.

The last plot is a warning. The correlation only measures linear relationships: here its value is small, but there is a strong nonlinear relationship between xx and yy.

Example 2.26 (The country data).

Which countries’ markets go up and down together? With many countries that would be a lot of scatter plots. Figure 2.19 shows one of them, the USA against Canada, with correlation 0.6510.651.

To summarise all of them we compute every pairwise correlation.

AusBelCanFinFraGerHKItaJapUSA
Belgium0.1890.189
Canada0.5070.5070.3570.357
Finland0.3870.3870.1830.1830.3860.386
France0.2750.2750.7340.7340.3420.3420.1760.176
Germany0.2260.2260.6910.6910.3020.3020.3040.3040.7090.709
Hong Kong0.3340.3340.3010.3010.5580.5580.3550.3550.3590.3590.3390.339
Italy0.1590.1590.3670.3670.3340.3340.3890.3890.3520.3520.4650.4650.2610.261
Japan0.2510.2510.4180.4180.2710.2710.3070.3070.4210.4210.3180.3180.2190.2190.4260.426
USA0.3600.3600.4290.4290.6510.6510.2640.2640.5010.5010.3720.3720.4290.4290.2400.2400.2460.246
Singapore0.4090.4090.3550.3550.4780.4780.3910.3910.4080.4080.4670.4670.6470.6470.4160.4160.4070.4070.4730.473

The upper half of the table is left blank because the correlation between two countries does not depend on the order in which we take them, so it would repeat the lower half, and the diagonal would only record that each country is perfectly correlated with itself. The most closely linked markets are neighbours: Belgium and France, France and Germany, Canada and the USA, Hong Kong and Singapore.

−0.10−0.050.000.050.10−0.10−0.050.000.050.10Canada monthly returnUSA monthly return
Figure 2.19. Monthly returns of the USA against those of Canada, February 1988 to December 1996.

Understanding the Formulae

To get a feeling for how these formulae capture a relationship, we go back to the four years of returns on two assets and compute their covariance and correlation. First the covariance, which is the necessary ingredient:

sxy=13[(0.07−0.05)(0.11−0.07)+(0.06−0.05)(0.05−0.07)+(0.04−0.05)(0.09−0.07)+(0.03−0.05)(0.03−0.07)]=13[(0.02)(0.04)+(0.01)(−0.02)+(−0.01)(0.02)+(−0.02)(−0.04)]=13[0.0008−0.0002−0.0002+0.0008]=0.00123=0.0004.\begin{aligned} s_{xy} &= \frac{1}{3}\bigl[(0.07 - 0.05)(0.11 - 0.07) + (0.06 - 0.05)(0.05 - 0.07) + (0.04 - 0.05)(0.09 - 0.07) + (0.03 - 0.05)(0.03 - 0.07)\bigr] \\ &= \frac{1}{3}\bigl[(0.02)(0.04) + (0.01)(-0.02) + (-0.01)(0.02) + (-0.02)(-0.04)\bigr] \\ &= \frac{1}{3}\bigl[0.0008 - 0.0002 - 0.0002 + 0.0008\bigr] = \frac{0.0012}{3} = 0.0004 . \end{aligned}

Each of the four points makes a contribution to the sum. Figure 2.20 shows which point does what.

(x₁, y₁): +0.0008(x₂, y₂): −0.0002(x₃, y₃): −0.0002(x₄, y₄): +0.0008IIIIIIIV0.030.040.050.060.070.030.050.070.090.11xy
Figure 2.20. The four points with dashed lines at xˉ=0.05\bar{x} = 0.05 and yˉ=0.07\bar{y} = 0.07, and each point’s contribution (xi−xˉ)(yi−yˉ)(x_i - \bar{x})(y_i - \bar{y}).
  1. A point in region I has both xx and yy bigger than their means, so it makes a positive contribution to the covariance.
  2. A point in region II has both xx and yy less than their means, so it also makes a positive contribution.
  3. In regions III and IV one of xx and yy is less than its mean and the other is greater, so the contribution is negative.

The further out the point is, the bigger its contribution. A scatter plot with most of its points in regions I and II, and just a few relatively small contributions from regions III and IV, has a positive covariance. So

  1. a positive covariance means that when one variable is above its average the other tends to be above its average as well: they move up and down together;
  2. a negative covariance means that when one is up the other tends to be down: they move in opposite directions;
  3. a small covariance means that their movements are almost linearly unrelated.

We finish the example with the correlation, using sx=0.0183s_x = 0.0183 and sy=0.0365s_y = 0.0365 from before:

rxy=0.0004(0.0183)(0.0365)=0.60.r_{xy} = \frac{0.0004}{(0.0183)(0.0365)} = 0.60 .

The division by the standard deviations standardises the covariance, so that the correlation is always between −1-1 and 11. The correlation has the same sign as the covariance, since standard deviations are always positive, so its sign carries the same information: a positive sign means a positive relationship and a negative sign a negative one. The correlation is more informative, though, because it is unit-less and always between −1-1 and 11 by construction, which makes it the better measure of the strength of the relationship.

The Slope of the Best-Fit Line

Should the body mass of a penguin be positively or negatively associated with its bill length? Figure 2.21 suggests a positive association: heavier penguins tend to have longer bills. How can we quantify it? One idea is the slope of the best-fit line through the scatter plot, but the slope has two problems.

The slope is sensitive to units. With body mass in grams the slope of the best-fit line is 0.004050.00405 mm per gram. If we measure the same penguins in ounces, the points and the line look exactly the same, but the slope becomes 0.1150.115 mm per ounce. An ounce is 28.3528.35 grams, so the same rise in bill length now happens over a run 28.3528.35 times smaller in number, and the slope is 28.3528.35 times larger.

3,0004,5006,000354555body mass (g)bill length (mm)grams: slope 0.00405 mm per g100150200354555body mass (oz)bill length (mm)ounces: slope 0.115 mm per oz
Figure 2.21. Bill length against body mass for 342342 penguins with the best-fit line, with mass in grams and then in ounces.

The slope is also sensitive to variability. Some variables vary much less than others, and then the slope can never be large. Bill length varies only from 32.132.1 to 59.659.6 mm, while body mass varies from 2,7002{,}700 to 6,3006{,}300 g.

Problem 2.9.

  1. What is the slope of the line through the points (3000,40)(3000, 40) and (6000,50)(6000, 50)?
  2. Explain why, if a variable xx varies in the range 2,7002{,}700 to 6,3006{,}300 and a variable yy varies in the range 3232 to 6060, the slope of the best-fit line of yy on xx will never get close to 11.

When we meet a number we always want to put it in context. What can we compare it with? Can we transform it so that it is easier to compare? In the last lesson we transformed counts into percentages to make them easier to compare, and instead of the dollars lost to fraud we looked at the percentage of the budget lost to fraud. Here we set up a measure of association which is easy to compare across different kinds of data, by rescaling the data so that they are unitless and have the same variability.

Standardising

Definition 2.27 (Standardised Data).

To standardise the data x1,…,xnx_1, \ldots, x_n, subtract the mean xˉ\bar{x} from every observation and divide by the standard deviation σx\sigma_x. The standardised data are z1,…,znz_1, \ldots, z_n, where

zi=xi−xˉσx.z_i = \frac{x_i - \bar{x}}{\sigma_x} .

Problem 2.10.

Explain why standardised data always have mean 00 and standard deviation 11, and why they are unitless.

So standardising equalises the variability: if we want to find an association between two data sets and standardise both first, both have the same standard deviation.

The Correlation Coefficient

Our data contain pairs (xi,yi)(x_i, y_i), and we want to measure the association between xx and yy. The correlation coefficient is the slope of the best-fit line through the standardised xx and yy data, and it can be computed as the average product of the standardised values:

r=1n∑i=1nxi−xˉσx⋅yi−yˉσy.r = \frac{1}{n}\sum_{i=1}^{n} \frac{x_i - \bar{x}}{\sigma_x} \cdot \frac{y_i - \bar{y}}{\sigma_y} .

This is the same number as the sample correlation rxy=sxysxsyr_{xy} = \dfrac{s_{xy}}{s_x s_y}. The sum is 1n∑(xi−xˉ)(yi−yˉ)\dfrac{1}{n}\sum (x_i - \bar{x})(y_i - \bar{y}) divided by σxσy\sigma_x\sigma_y. Using divisor n−1n - 1 throughout, in the covariance and in both standard deviations, multiplies the top by nn−1\dfrac{n}{n - 1} and the bottom by nn−1nn−1=nn−1\sqrt{\dfrac{n}{n - 1}}\sqrt{\dfrac{n}{n - 1}} = \dfrac{n}{n - 1} as well, so the factors cancel.

For the penguins, with xx the body mass and yy the bill length, the association is positive but not perfect: r=0.595r = 0.595.

−2−10123−2−10123standardised body massstandardised bill length
Figure 2.22. Standardised bill length against standardised body mass for the 342342 penguins. The best-fit line through the origin has slope r=0.595r = 0.595.

Remark.

The quantity 1n∑i=1n(xi−xˉ)(yi−yˉ)\dfrac{1}{n}\sum_{i=1}^{n} (x_i - \bar{x})(y_i - \bar{y}), the covariance with divisor nn, is sometimes itself called the correlation. It is the correlation coefficient without the rescaling by the standard deviations.

What Correlation Can Tell Us

Covariance, correlation and the correlation coefficient are summary statistics of two variables which quantify the association between them.

  1. If there is a strong association between two variables, knowing one helps a lot in predicting the other. The correlation between body mass and bill length, for instance, lets us estimate the average bill length of penguins of a given weight.
  2. When there is a weak association, information about one variable does not help much in guessing the other.

The correlation coefficient has three useful properties.

  1. It is unitless.
  2. Changing the units of xx or of yy, as from grams to ounces, does not change it.
  3. It does not change if we interchange xx and yy: like the covariance, it is symmetric in the two variables.

Correlation Is Not Causation

If xx and yy are correlated, can we infer that xx causes yy, or that yy causes xx? No. Many variables are correlated without any causal relationship between them. For the years 20002000 to 20092009 the divorce rate in the US state of Maine and the consumption of margarine per person in the US have a correlation coefficient of 0.9930.993. Both fell over the decade, for quite unrelated reasons.

Source: Tyler Vigen, Spurious Correlations

Robustness

Like the mean and the standard deviation, the correlation can be greatly affected by outliers.

Example 2.28 (GDP in 1960 and 2000).

For the 111111 countries with a GDP recorded in both 19601960 and 20002000, the correlation between the two is 0.9330.933. But the data are dominated by a few very large economies: 9494 of the 111111 countries, 85%85\% of them, had a GDP below the 19601960 mean. For those 9494 countries alone the correlation is only 0.6740.674.

Source: World Bank, GDP (current US$), individual countries with values for both years.

020040060005,00010,000GDP 1960 (US dollars, bn)GDP 2000 (US dollars, bn)all 111 countries: r = 0.93305100200400600GDP 1960 (US dollars, bn)GDP 2000 (US dollars, bn)94 below the 1960 mean: r = 0.674
Figure 2.23. GDP in 2000 against GDP in 1960, for all 111111 countries and for the 9494 countries below the 1960 mean. The scales of the two plots are different.

Associations Not Captured by Correlation

Variables can be associated without being linearly associated. In the last plot of Figure 2.18, yy is a quadratic function of xx, so knowing xx tells us yy exactly, yet the correlation coefficient is only −0.127-0.127.

Simpson’s Paradox

Sometimes, if a data set has several groups or modes, the slope of the best-fit line for the whole data set differs from the slope for each group, even in sign. This phenomenon is called Simpson’s paradox.

Example 2.29 (The bills of penguins).

The length and depth of the penguins’ bills appear negatively associated when we look at all three species together: the correlation is −0.235-0.235. But when we look at each species separately, the two are clearly positively associated, with correlations 0.3910.391 for the Adélie, 0.6540.654 for the Chinstrap and 0.6430.643 for the Gentoo penguins. The Gentoos have long, shallow bills and the Adélies short, deep ones, and that difference between the species produces the downward slope of the combined data.

354555141720bill length (mm)bill depth (mm)all penguins: r = −0.235AdélieChinstrapGentoo354555141720bill length (mm)bill depth (mm)each species separately
Figure 2.24. Bill depth against bill length for the 342342 penguins, all together and then species by species, each with its best-fit line.

Linearly Related Variables

We have studied data sets which display some kind of relationship with each other, such as the returns on a mutual fund and on the market. Sometimes there is an exact linear relationship between two variables,

y=c0+c1x.y = c_0 + c_1 x .

Can we then say something about the mean of yy if all we know is the mean of xx, and something about the standard deviation of yy if all we know is the standard deviation of xx?

Example 2.30 (Celsius and Fahrenheit).

These temperatures are recorded in degrees Celsius and in degrees Fahrenheit, which are related by F=32+95CF = 32 + \frac95 C.

Celsius10101515202025254040303050507070
Fahrenheit50505959686877771041048686122122158158

If we plot the Fahrenheit values against the Celsius values, every point lies on one straight line, and the correlation is exactly 11.

Definition 2.31 (Linear Function).

The variable yy is a linear function of the variable xx if

y=c0+c1x,y = c_0 + c_1 x,

where the constants c0c_0 and c1c_1 are fixed numbers, the intercept and the slope, while xx and yy vary.

Example 2.32 (A film star's pay).

A film star has a deal which pays a fee of $10 million per film plus 10%10\% of the film’s gross takings. In millions of dollars the star’s income from a film is

income=10+0.1×gross,\text{income} = 10 + 0.1 \times \text{gross},

a linear function of the gross, with intercept 1010 and slope 0.10.1.

Mean and Standard Deviation of a Linear Function

Suppose the data yy are a linear function of the data xx. To see how the mean and standard deviation of yy are related to those of xx, take eight Celsius temperatures, multiply them by 95\frac95, and then add 3232 to obtain Fahrenheit.

meansample standard deviation
Celsius−10-100010101515202025253030353515.62515.62515.2215.22
×95\times \frac95−18-180018182727363645455454636328.12528.12527.4027.40
Fahrenheit1414323250505959686877778686959560.12560.12527.4027.40
celmulfahr−20020406080100
Figure 2.25. The eight Celsius temperatures, the same values multiplied by 95\frac95, and the Fahrenheit temperatures, on one scale.
  1. When we multiply by 95\frac95 we increase both the mean and the standard deviation proportionally: 15.625×95=28.12515.625 \times \frac95 = 28.125 and 15.22×95=27.4015.22 \times \frac95 = 27.40.
  2. When we add a constant, 3232 here, we simply increase the mean by the value of the constant and leave the dispersion unaffected.

In general, if yi=c0+c1xiy_i = c_0 + c_1 x_i for every ii, then

yˉ=c0+c1xˉ,sy=∣c1∣ sx,sy2=c12sx2.\bar{y} = c_0 + c_1\bar{x}, \qquad s_y = |c_1|\, s_x, \qquad s_y^2 = c_1^2 s_x^2 .

We see this by averaging, yˉ=1n∑i=1n(c0+c1xi)=c0+c1xˉ\bar{y} = \dfrac{1}{n}\sum_{i=1}^{n} (c_0 + c_1 x_i) = c_0 + c_1\bar{x}, which gives yi−yˉ=c1(xi−xˉ)y_i - \bar{y} = c_1(x_i - \bar{x}). Squaring, (yi−yˉ)2=c12(xi−xˉ)2(y_i - \bar{y})^2 = c_1^2(x_i - \bar{x})^2, and summing and dividing by n−1n - 1 gives sy2=c12sx2s_y^2 = c_1^2 s_x^2.

Problem 2.11.

  1. The film star makes 1010 films, and the mean and standard deviation of the gross takings of the films are 100100 and 3030 million dollars. What are the mean and the standard deviation of the star’s income per film?
  2. The data xx have mean 100100 and standard deviation 1010. What are the mean, standard deviation and variance of y=−2xy = -2x, of y=5+xy = 5 + x and of y=5−2xy = 5 - 2x?

Linear Combinations

We may want a variable to be related to several others instead of just one. Suppose the film star also receives 5%5\% of all sales of the soundtrack album released with the film. In millions of dollars, the star’s income is then related to the film’s gross and to the album’s sales by

income=10+0.1×gross+0.05×album sales.\text{income} = 10 + 0.1 \times \text{gross} + 0.05 \times \text{album sales} .

Definition 2.33 (Linear Combination).

A variable yy is a linear combination of the variables x1,x2,…,xkx_1, x_2, \ldots, x_k if

y=c0+c1x1+c2x2+⋯+ckxky = c_0 + c_1 x_1 + c_2 x_2 + \cdots + c_k x_k

for constants c0,c1,…,ckc_0, c_1, \ldots, c_k. The constant cic_i is the coefficient of xix_i.

Portfolios

The most important example of a linear combination is a portfolio.

Example 2.34 (Splitting an investment).

Suppose we have $100 to invest in two assets. Let x1x_1 be the return on asset 11: if x1=0.1x_1 = 0.1 and we put all our money into asset 11, we have $110 at the end of the period. Let x2x_2 be the return on asset 22: if x2=0.15x_2 = 0.15 and we put all our money into asset 22, we have $115. Suppose instead we put half the money into each. At the end of the period we have, in dollars,

100×0.5×(1+0.1)+100×0.5×(1+0.15)=100 (1+0.5×0.1+0.5×0.15)=100 (1+0.125),100 \times 0.5 \times (1 + 0.1) + 100 \times 0.5 \times (1 + 0.15) = 100\,(1 + 0.5 \times 0.1 + 0.5 \times 0.15) = 100\,(1 + 0.125),

so the return on the split investment is 0.5×0.1+0.5×0.15=0.1250.5 \times 0.1 + 0.5 \times 0.15 = 0.125.

To generalise, let w1w_1 be the fraction of our wealth invested in asset 11, w2w_2 the fraction invested in asset 22, and MM our wealth. The ww‘s are called the portfolio weights, and w1+w2=1w_1 + w_2 = 1. At the end of the period we have

w1M(1+x1)+w2M(1+x2)=M(w1+w2+w1x1+w2x2)=M(1+w1x1+w2x2),w_1 M(1 + x_1) + w_2 M(1 + x_2) = M(w_1 + w_2 + w_1 x_1 + w_2 x_2) = M(1 + w_1 x_1 + w_2 x_2),

so the return on the portfolio is

Rp=w1x1+w2x2.R_p = w_1 x_1 + w_2 x_2 .

The return on the portfolio is a linear combination of the asset returns, whose coefficients are the portfolio weights. In the same way, if we have mm assets, the return on the iith is xix_i, and we put a fraction wiw_i of our wealth into asset ii, then the portfolio is determined by its weights and its return is

Rp=w1x1+w2x2+⋯+wmxm=∑i=1mwixi.R_p = w_1 x_1 + w_2 x_2 + \cdots + w_m x_m = \sum_{i=1}^{m} w_i x_i .

The portfolio weights always add up to one: if we invest 30%30\% of our wealth in asset 11 and have only two assets, we must invest 70%70\% in asset 22.

Problem 2.12.

  1. Can the portfolio weights add up to one with some of them negative? What does it mean to invest −30%-30\% of our wealth in asset 11 and 130%130\% in asset 22?
  2. What is the equally weighted portfolio of mm assets?
  3. What is a value-weighted portfolio?

Example 2.35 (The country data again).

Suppose we had put half our money into the USA and half into Hong Kong. For each month the portfolio return is 12×Hong Kong+12×USA\frac12 \times \text{Hong Kong} + \frac12 \times \text{USA}. The first five months are these.

monthHong KongUSAportfolio
February 19880.020.020.040.040.0300.030
March 19880.060.06−0.03-0.030.0150.015
April 19880.020.020.010.010.0150.015
May 1988−0.03-0.030.010.01−0.010-0.010
June 19880.080.080.050.050.0650.065

How do the returns on this portfolio compare with those of Hong Kong and the USA? In Figure 2.26 the mean of the portfolio is right in between the means of the USA and Hong Kong. Its standard deviation, however, is closer to the USA’s than halfway.

Hong KongUSA½ Hong Kong + ½ USA0.030.040.050.060.070.01200.01450.01700.01950.0220standard deviationmean
Figure 2.26. Mean against standard deviation of monthly return for Hong Kong, the USA and the half-and-half portfolio.

A portfolio can also use three countries. Suppose we go short on Canada, that is we borrow Canadian shares worth half our wealth and sell them, and invest in the other two:

Rp=−12×Canada+1×USA+12×Hong Kong.R_p = -\tfrac12 \times \text{Canada} + 1 \times \text{USA} + \tfrac12 \times \text{Hong Kong} .

The weights add up to 11. This portfolio has a mean monthly return of 0.01940.0194, above the USA’s and close to Hong Kong’s 0.02100.0210, with a standard deviation of 0.04700.0470, far below Hong Kong’s 0.07220.0722. Forming portfolios is clearly an interesting thing to do.

Hong KongUSACanada−½ Canada + USA + ½ Hong Kong0.030.040.050.060.070.00600.01050.01500.01950.0240standard deviationmean
Figure 2.27. Mean against standard deviation for Hong Kong, the USA, Canada and the portfolio short in Canada.

Why would we form portfolios? Perhaps a portfolio has a nicer mean and variance, a nicer average return and a nicer risk, than the assets it is made of. Some basic formulae relate the mean and standard deviation of a linear combination to the means, variances and covariances of its inputs, and applying them to portfolios shows how the mean and variance of a portfolio depend on the assets in it. These formulae are the basic part of the tool-kit of anyone working in finance.

Mean and Variance of a Linear Combination

First we consider the case of only two inputs. If yi=c0+c1x1i+c2x2iy_i = c_0 + c_1 x_{1i} + c_2 x_{2i} for every observation ii, then

yˉ=c0+c1xˉ1+c2xˉ2,sy2=c12sx12+c22sx22+2c1c2sx1x2.\bar{y} = c_0 + c_1\bar{x}_1 + c_2\bar{x}_2, \qquad s_y^2 = c_1^2 s_{x_1}^2 + c_2^2 s_{x_2}^2 + 2c_1 c_2 s_{x_1x_2} .

We see this as for a single input. Averaging gives the formula for yˉ\bar{y}, and then

yi−yˉ=c1(x1i−xˉ1)+c2(x2i−xˉ2).y_i - \bar{y} = c_1(x_{1i} - \bar{x}_1) + c_2(x_{2i} - \bar{x}_2) .

Squaring,

(yi−yˉ)2=c12(x1i−xˉ1)2+c22(x2i−xˉ2)2+2c1c2(x1i−xˉ1)(x2i−xˉ2),(y_i - \bar{y})^2 = c_1^2(x_{1i} - \bar{x}_1)^2 + c_2^2(x_{2i} - \bar{x}_2)^2 + 2c_1 c_2(x_{1i} - \bar{x}_1)(x_{2i} - \bar{x}_2),

and summing over ii and dividing by n−1n - 1 gives the formula for sy2s_y^2. The covariance term is why the variance of a combination differs from the same combination of the variances.

Problem 2.13.

Going back to the film star, suppose the average sales of the album are $5 million with a standard deviation of $1 million, and that the correlation between a film’s gross and its album sales is 0.80.8.

  1. What are the mean and the standard deviation of the star’s income?
  2. How would the answer change if the correlation were 00?

Example 2.36 (Checking the formulae on the country data).

For the portfolio 12×Hong Kong+12×USA\frac12 \times \text{Hong Kong} + \frac12 \times \text{USA}, the mean returns on the USA and Hong Kong are 0.013460.01346 and 0.021030.02103. Knowing the portfolio returns, the sample mean of the portfolio return is 0.017240.01724, and the formula agrees:

0.5×0.01346+0.5×0.02103=0.01724.0.5 \times 0.01346 + 0.5 \times 0.02103 = 0.01724 .

The sample variances and covariances of the three series are these.

Hong KongUSAportfolio
Hong Kong0.005214970.00521497
USA0.001030370.001030370.001107740.00110774
portfolio0.003122670.003122670.001069060.001069060.002095860.00209586

The diagonal elements are variances and the off-diagonal elements are covariances; a table like this is a variance–covariance matrix. As before we can check the formula for the variance:

(0.5)2(0.00521497)+(0.5)2(0.00110774)+2(0.5)(0.5)(0.00103037)=0.00130374+0.00027694+0.00051519=0.00209587,(0.5)^2(0.00521497) + (0.5)^2(0.00110774) + 2(0.5)(0.5)(0.00103037) = 0.00130374 + 0.00027694 + 0.00051519 = 0.00209587,

which is the variance of the portfolio up to rounding.

Let us do it one more time, for the portfolio 14×USA+34×Hong Kong\frac14 \times \text{USA} + \frac34 \times \text{Hong Kong}, whose sample variance is 0.003389050.00338905:

(0.25)2(0.00110774)+(0.75)2(0.00521497)+2(0.25)(0.75)(0.00103037)=0.00006923+0.00293342+0.00038639=0.00338904.(0.25)^2(0.00110774) + (0.75)^2(0.00521497) + 2(0.25)(0.75)(0.00103037) = 0.00006923 + 0.00293342 + 0.00038639 = 0.00338904 .

Example 2.37 (The effect of the covariance).

Each plot of Figure 2.28 shows 2020 constructed pairs (x1,x2)(x_1, x_2), and in each case y=0.5x1+0.5x2y = 0.5x_1 + 0.5x_2.

  1. In the first plot sx12=1.334636s_{x_1}^2 = 1.334636, sx22=1.106238s_{x_2}^2 = 1.106238 and sx1x2=−1.208679s_{x_1x_2} = -1.208679, so sy2=0.25(1.334636)+0.25(1.106238)+0.5(−1.208679)=0.005879s_y^2 = 0.25(1.334636) + 0.25(1.106238) + 0.5(-1.208679) = 0.005879. The variance of yy is much smaller than those of the xx‘s, because the covariance is large and negative: whenever x1x_1 is above its mean x2x_2 tends to be below its mean by about as much, and the average hardly moves.
  2. In the second, sx12=1.158167s_{x_1}^2 = 1.158167, sx22=0.960946s_{x_2}^2 = 0.960946 and sx1x2=1.046490s_{x_1x_2} = 1.046490, so sy2=0.289542+0.240237+0.523245=1.053024s_y^2 = 0.289542 + 0.240237 + 0.523245 = 1.053024. The variance of yy is not much smaller than those of the xx‘s, because the two move up and down together and averaging cancels almost nothing.
  3. In the third, sx12=1.387054s_{x_1}^2 = 1.387054, sx22=0.824789s_{x_2}^2 = 0.824789 and sx1x2=0.197619s_{x_1x_2} = 0.197619, so sy2=0.346764+0.206197+0.098810=0.651771s_y^2 = 0.346764 + 0.206197 + 0.098810 = 0.651771. The covariance is small, and the variance of yy is noticeably smaller than those of the xx‘s: averaging two variables which are nearly unrelated reduces the variability.
variance of y: 0.0059variance of y: 1.0530variance of y: 0.6518
Figure 2.28. Three sets of 2020 pairs (x1,x2)(x_1, x_2) with dashed lines at the means, and the variance of y=0.5x1+0.5x2y = 0.5x_1 + 0.5x_2 for each.

With kk inputs, if y=c0+c1x1+c2x2+⋯+ckxky = c_0 + c_1 x_1 + c_2 x_2 + \cdots + c_k x_k, the same argument gives yˉ=c0+c1xˉ1+⋯+ckxˉk\bar{y} = c_0 + c_1\bar{x}_1 + \cdots + c_k\bar{x}_k and

sy2=∑i=1kci2sxi2+2∑i<jcicjsxixj,s_y^2 = \sum_{i=1}^{k} c_i^2 s_{x_i}^2 + 2\sum_{i < j} c_i c_j s_{x_ix_j},

where the second sum runs over all pairs of inputs. For three inputs this is

sy2=c12sx12+c22sx22+c32sx32+2c1c2sx1x2+2c1c3sx1x3+2c2c3sx2x3.s_y^2 = c_1^2 s_{x_1}^2 + c_2^2 s_{x_2}^2 + c_3^2 s_{x_3}^2 + 2c_1 c_2 s_{x_1x_2} + 2c_1 c_3 s_{x_1x_3} + 2c_2 c_3 s_{x_2x_3} .

Example 2.38 (A portfolio of three funds).

Take the portfolio 0.1×fidel+0.4×eqmrkt+0.5×windsor0.1 \times \text{fidel} + 0.4 \times \text{eqmrkt} + 0.5 \times \text{windsor}. The sample variances and covariances of the four series are these.

portfoliofideleqmrktwindsor
portfolio0.003067600.00306760
fidel0.002802240.002802240.003202100.00320210
eqmrkt0.003693840.003693840.003191500.003191500.004700210.00470021
windsor0.002619670.002619670.002410870.002410870.002989220.002989220.002365800.00236580

The formula for three inputs gives

sy2=(0.1)2(0.00320210)+(0.4)2(0.00470021)+(0.5)2(0.00236580)+2[(0.1)(0.4)(0.00319150)+(0.1)(0.5)(0.00241087)+(0.4)(0.5)(0.00298922)]=0.00003202+0.00075203+0.00059145+2[0.00012766+0.00012054+0.00059784]=0.00137550+0.00169209=0.00306760,\begin{aligned} s_y^2 &= (0.1)^2(0.00320210) + (0.4)^2(0.00470021) + (0.5)^2(0.00236580) \\ &\qquad + 2\bigl[(0.1)(0.4)(0.00319150) + (0.1)(0.5)(0.00241087) + (0.4)(0.5)(0.00298922)\bigr] \\ &= 0.00003202 + 0.00075203 + 0.00059145 + 2\bigl[0.00012766 + 0.00012054 + 0.00059784\bigr] \\ &= 0.00137550 + 0.00169209 = 0.00306760, \end{aligned}

which is exactly the variance of the portfolio.

Exercises

Exercise 2.1.

The first five monthly returns of Hong Kong and the USA were 0.02,0.06,0.02,−0.03,0.080.02, 0.06, 0.02, -0.03, 0.08 and 0.04,−0.03,0.01,0.01,0.050.04, -0.03, 0.01, 0.01, 0.05.

  1. Compute by hand the mean and the sample variance of each series, and their sample covariance.
  2. Use the formulae for a linear combination to find the mean and the sample variance of the portfolio 12×Hong Kong+12×USA\frac12 \times \text{Hong Kong} + \frac12 \times \text{USA} over these five months.
  3. Check your answers against the portfolio returns 0.030,0.015,0.015,−0.010,0.0650.030, 0.015, 0.015, -0.010, 0.065.

Exercise 2.2.

Of the 107107 monthly Japanese returns, 2626 lie more than one standard deviation from the mean, 77 lie more than two standard deviations from it, and one lies more than three.

  1. What proportions lie within one, two and three standard deviations of the mean?
  2. Compare these proportions with what Chebyshev’s inequality guarantees and with what the empirical rule predicts.

Exercise 2.3.

In the American Sex Survey, men reported a median of 88 lifetime partners and a mean of 2020, and women a median of 33 and a mean of 66.

  1. What do these figures suggest about the shape of each distribution?
  2. Which of the two summaries better describes a typical respondent, and why?
  3. A newspaper headline reads “The average man has had 20 partners”. What is misleading about it?

Exercise 2.4.

Seattle’s daily mean temperatures over 2024 and 2025 have mean 11.6911.69 °C and standard deviation 5.635.63 °C, with 1010th and 9090th percentiles 4.74.7 °C and 19.419.4 °C. Using F=32+95CF = 32 + \frac95 C, find the mean, the standard deviation and the 1010–9090 percentile window in degrees Fahrenheit, and explain why the correlation between the Seattle and Chicago temperatures would not change if both were converted to Fahrenheit.

Exercise 2.5.

Over the 107107 months, the Canadian and USA monthly returns have means 0.009070.00907 and 0.013460.01346, standard deviations 0.038330.03833 and 0.033280.03328, and correlation 0.6510.651. Find the mean and the standard deviation of the portfolio 12×Canada+12×USA\frac12 \times \text{Canada} + \frac12 \times \text{USA}, and compare them with those of the two countries.

Exercise 2.6.

The five pairs (x,y)(x, y) are (1,2)(1, 2), (2,4)(2, 4), (3,5)(3, 5), (4,4)(4, 4) and (5,7)(5, 7).

  1. Compute by hand the sample covariance and the correlation between xx and yy.
  2. Find the sample covariance and the correlation between u=3xu = 3x and v=y+10v = y + 10.

Exercise 2.7.

Show that if vi=a+byiv_i = a + b y_i for every ii, with b≠0b \neq 0, then the correlation between xx and vv equals the correlation between xx and yy when b>0b > 0, and is its negative when b<0b < 0.

Exercise 2.8.

Chicago’s daily mean temperatures over 2024 and 2025 have mean 11.2111.21 °C and standard deviation 10.6610.66 °C, and 99.7%99.7\% of the days lie within three standard deviations of the mean.

  1. What proportion does Chebyshev’s inequality guarantee within three standard deviations?
  2. Find the interval of temperatures within three standard deviations of the mean.
  3. The coldest day was −21.1-21.1 °C. Was it inside the interval?

Check Yourself

 

Fresh questions on the whole lesson — none of them is worked out above. Do each on paper first; the box only tells you whether you got there.

Answers are checked in your browser, as often as you like. Nothing is sent anywhere and nothing is kept but your own work. A formula may be written with the symbols themselves or with ~ & | -> <-> ^, and \and, \or, \to expand as you type.

Exercise 2.9.

What is the mean of 3,7,8,10,123, 7, 8, 10, 12?

answer one of these

Exercise 2.10.

What is the median of 2,9,4,7,1,82, 9, 4, 7, 1, 8?

answer one of these

Exercise 2.11.

What is the sample variance of 2,4,62, 4, 6?

answer one of these

Exercise 2.12.

Masses are recorded in kilograms. In what units is their variance?

answer one of these

Exercise 2.13.

If 55 is added to every observation, what happens to the mean and the standard deviation?

answer one of these

Exercise 2.14.

The data xx have standard deviation 55. What is the standard deviation of y=3−2xy = 3 - 2x?

answer one of these

Exercise 2.15.

By Chebyshev’s inequality, at most what fraction of any data set lies more than three standard deviations from the mean?

answer one of these

Exercise 2.16.

For mound-shaped data, about what percentage of the observations lie within two standard deviations of the mean?

answer one of these

Exercise 2.17.

What is the correlation between xx and yy for the pairs (1,3)(1, 3), (2,5)(2, 5), (3,7)(3, 7)?

answer one of these

Exercise 2.18.

A distribution is strongly skewed to the right. Which is usually true?

answer one of these

Exercise 2.19.

Two assets have mean returns 0.010.01 and 0.030.03. What is the mean return of the portfolio with weights 0.250.25 and 0.750.75?

answer one of these

Exercise 2.20.

The variables x1x_1 and x2x_2 have sample variances 44 and 99 and sample covariance 00. What is the sample variance of x1+x2x_1 + x_2?

answer one of these

Exercise 2.21.

The correlation between body mass in grams and bill length in millimetres is 0.5950.595. What is the correlation between body mass in kilograms and bill length in centimetres?

answer one of these

Exercise 2.22.

What fraction of a data set lies between its 1010th and 9090th percentiles?

answer one of these