Business Analytics & Data Science

B05 · Intermediate

Correlation Analysis

10 lessons

B05 · Module 3, lesson 1 · Lesson 5 of 10

Outliers and influence

One wrong digit among 612 days can turn a near-perfect correlation into a middling one. Find the points that move a correlation, measure how much each one matters, and decide what to do with them without deleting what you dislike.

About 75 minutes

Before you start

You will be able to

  • Distinguish points that are unusual in x, in y and in both, and predict whether each will raise or lower Pearson’s r.
  • Calculate leave-one-out correlations and use them to measure how much a single point moves r.
  • Explain, with z-scores and standard deviations, why one extreme value can drag r down even though its own share of r is small.
  • Diagnose a data-entry slip with plausibility checks, correct it from the source and record the change.
  • Write up a correlation with and without genuine extreme points, and use rank correlation as a check on robustness.

Review first

  • Covariance and Pearson’s r — Pearson’s r as covariance divided by the two standard deviations, and as the average product of z-scores.
  • Rank correlation — Spearman’s ρ, which this lesson uses as a check on how much a few points matter.
  • Outliers and impossible values — Z-scores, fences and the difference between an error and a genuine extreme in one variable.

Fictional case A fictional coffee business founded by Ana Lim. It starts as a catering and barista-training service, opens its own cafés and an online shop for beans, and plans a canned cold brew.

The idea

Fictional case

At the end of 2027 Ana asks the café log a simple question: do more people through the door mean more sales at the till? She expects footfall and transactions to move almost in step, since about half of the people the door counter sees buy something. Across the 612 café-days she gets r = 0.679. That is a fair correlation, but far weaker than the plot of a typical week suggests.

One point among 612

The scatterplot answers the puzzle at once. Almost every day sits in a tight band rising from bottom left to top right, and one point sits far to the right on its own: Millbrook on Tuesday 14 September, with a footfall of 2,566 and 130 transactions. No other Millbrook day reached 410 people. A day on which 2,566 people came in and only 130 bought anything would mean a conversion of 5.1%, when every other day in the log converts between 28% and 67% of visitors.

Ana checks the door counter’s own daily export: it says 256. Whoever typed the log added a 6. Corrected, the correlation between footfall and transactions is 0.981. A single slip among 612 rows had cut r by 0.302, from a relationship that is close to a straight line to one that looks only moderate.

This lesson is about such points. An outlier is an observation that lies an abnormal distance from the rest. With two variables, “abnormal” can mean far out on x, far out on y, or simply far from the pattern the other points follow. Some outliers are errors to be corrected; others are real days that deserve to be kept and explained. What they share is that a correlation coefficient, which is built from distances from the mean, can be moved a long way by very few of them.

Where the point sits decides what it does

Whether an unusual point raises or lowers r depends on where it sits relative to the pattern. The figure adds one point to ten fictional points that rise together with r = 0.964.

The same ten fictional points (r = 0.964) with one extra point, circled. A, far to the right and in line with the others, raises r to 0.989. B, at an ordinary x but far above the others, lowers it to 0.575. C, far to the right but at an ordinary height, lowers it to 0.144.
  • Far out in x and in y, on the trend (A). The point stretches the pattern. It adds a large positive product of z-scores and makes the cloud look more like a line, so r rises, sometimes a lot. Harbourside’s festival days, with about four times the footfall of an ordinary day (three times that of an ordinary weekend day, and every festival fell on a weekend) and long waits to match, are of this kind.
  • Far out in y only (B). At an ordinary x the point’s z-score in x is small, so its own product contributes little; but it inflates the spread of y, which shrinks every other point’s contribution. r falls.
  • Far out in x, off the trend (C). The most damaging kind. It inflates the spread of x and contributes nothing in return, because its y is ordinary. Millbrook’s slip is exactly this point: a footfall ten times too large with an ordinary number of transactions.

Errors and genuine extremes

The slip and the festival days are both outliers, but they call for opposite treatment. The slip is an error with a known correct value: fix it, note the fix in the cleaning log, and carry on with the corrected log. The festival days are real: Harbour Days, the Fourth of July weekend and the Regatta really did bring 500 to 620 people through Harbourside’s door. Deleting them would describe a café that never had a festival. Keeping them without comment would let five days speak for 306. The honest course is to report the correlation both ways and say what the difference means.

In depth

Why one point can move r so far

Pearson’s r is the average product of z-scores, r=1n−1∑zxzyr = \frac{1}{n-1}\sum z_{x} z_{y}, where each z-score is a value’s distance from its mean in standard deviations. Each point contributes its own term zxzy/(n−1)z_{x} z_{y}/(n-1). You might expect the slip to damage r through a huge negative term, but its term is small and positive: its footfall is 18.3 standard deviations above the mean, its transactions only 0.71 above, and the product divided by 611 is 0.021.

The damage is done through the standard deviation. The slip raises the standard deviation of footfall from 87.1 to 129.9 people, so every other day’s z-score for footfall shrinks by about a third. In the corrected log all 612 terms add up to 0.981; with the slip, the other 611 add up to only 0.658. In short, r ≈ 0.981 × 87.1 ÷ 129.9 ≈ 0.66, plus the slip’s own 0.021. An outlier in x that does not follow the pattern lowers r mostly by inflating the spread, not by its own contribution.

The same reasoning explains the other two cases. A point far out on both variables and on the trend inflates both standard deviations but also adds a large positive product, enough to raise r. A point far out in y alone inflates the spread of y and adds little, so r falls.

Measuring influence: leave one out

An influential point is one whose removal would change a result noticeably. The simplest measure for a correlation is a leave-one-out analysis: compute r again without point i, call it r(−i)r_{(-i)}, and look at the change r(−i)−rr_{(-i)} - r for every point. With 612 points that is 612 correlations, which software does in an instant (the engine behind this course’s widgets does exactly this).

Leave-one-out changes in r for footfall and transactions, raw log (the two largest)
Day left outFootfallTransactionsr without itChange in r
14 Sep, Millbrook (the slip)2,5661300.981+0.302
29 May, Harbourside (festival)6202930.672−0.007

The table shows how lopsided influence can be. Removing the slip changes r by +0.302; removing any other single day changes it by at most 0.007. When one point’s change dwarfs all the others, look at that point before anything else. Influence says how much a point matters, not whether it is wrong: the festival day of 29 May is the second most influential day here, and it is perfectly genuine.

Regression has fuller measures of influence, such as leverage and Cook’s distance, which look at how a point moves a fitted line; B06 covers them. For a correlation, leave-one-out changes are usually enough.

Finding outliers in two variables

Screening each variable on its own, with z-scores or the 1.5 × IQR fences from B02, catches points like the slip, which is extreme in footfall. It misses a point that is ordinary on each variable but unusual in combination: a day with 300 visitors and 30 transactions has an unremarkable footfall and an unremarkable number of transactions, yet a conversion rate no real day has. Use three checks together:

  1. Plot. A scatterplot shows every kind of unusual point at once, including points that break the pattern without being extreme on either axis.
  2. Screen each variable with z-scores or fences, remembering that these are conventions (|z| > 3 is common, not a law).
  3. Check plausibility with a ratio or rule from the business. Transactions divided by footfall must lie between 0 and 1, and in practice between about a quarter and two thirds; iced plus hot drinks should be at least the transactions on most days; a wait can’t be negative. Ratios like these catch errors that no z-score will.

What to do, and what not to do

  1. Check the source. Go back to the door counter’s export, the till report, the paper roster. Most extreme values in business data are either real events or recording slips, and the source usually says which.
  2. Correct errors when the correct value is known, and record the change: what was wrong, what it became, and on what evidence.
  3. When a value is impossible and the source is lost, set it to missing (CORREL skips text and empty cells, and the engine uses pairwise deletion) and say so. Don’t guess a replacement.
  4. Keep genuine extremes, and report the correlation with and without them, with the reason the two differ.
  5. Check with ranks. Spearman’s ρ uses only the order of the values, so a point can be at most the largest rank. For the raw log, ρ is 0.970 with the slip and 0.971 without; when Pearson’s r and Spearman’s ρ disagree sharply, a few points are usually responsible.

What not to do is delete points because the result looks better without them. A correlation computed after removing the points that “don’t fit” is a correlation of your expectations. Decide your rules for handling outliers before you see which way they push the result, apply them to every point, and report every exclusion.

Genuine extremes: the festival days

At Harbourside, footfall and the average wait at the morning peak have r = 0.673 across all 306 days. The five festival days had footfalls of 502 to 620, between 5.2 and 6.9 standard deviations above the café’s mean, when no other day passed 282. Their waits were long as well, from 4.7 to 15.3 minutes against a typical 2. They are far out on both variables and broadly on the trend, so they pull r up: without them r is 0.476, and leaving out 29 May alone takes it to 0.595.

The same five days pull a different correlation the other way. Footfall and the day’s high temperature have r = 0.436 at Harbourside with the festivals and 0.508 without: festival crowds were huge on warm, but not unusually warm, days, so the five points sit far above the temperature trend, outliers in y. One set of genuine days can raise one correlation and lower another, which is why the decision to keep or set them aside should be made for the question, and reported.

Formulas

A point’s share of Pearson’s r

r=1n−1∑i=1nzx,i zy,i,zx,i=xi−xˉsx,zy,i=yi−yˉsyr = \frac{1}{n-1}\sum_{i=1}^{n} z_{x,i}\,z_{y,i}, \qquad z_{x,i} = \frac{x_i - \bar{x}}{s_x}, \quad z_{y,i} = \frac{y_i - \bar{y}}{s_y}
rr
Pearson’s correlation coefficient
nn
Number of pairs
zx,i,zy,iz_{x,i}, z_{y,i}
Point i’s z-scores on x and on y
xi,yix_i, y_i
Point i’s valuesunits of x, y
xˉ,yˉ\bar{x}, \bar{y}
Sample meansunits of x, y
sx,sys_x, s_y
Sample standard deviationsunits of x, y

Assumes. An identity, true for any data with non-zero standard deviations.

Each point contributes z_x z_y ÷ (n − 1). An extreme point also changes the means and standard deviations, and so every other point’s z-scores.

Leave-one-out change in r

Δri=r(−i)−r\Delta r_i = r_{(-i)} - r
rr
The correlation of all n points
r(−i)r_{(-i)}
The correlation of the n − 1 points left when point i is removed
Δri\Delta r_i
How much removing point i changes r (positive: r rises without it)

Compute it for every point and look at the largest changes. A large change says a point matters, not that it is wrong.

The largest possible z-score in a sample

∣zi∣≤n−1n|z_i| \le \frac{n-1}{\sqrt{n}}
ziz_i
Any value’s z-score, using the sample mean and sample standard deviation
nn
Number of values

Assumes. z-scores calculated with the sample standard deviation (n − 1), as STANDARDIZE with AVERAGE and STDEV.S does.

2.85 for n = 10, 4.25 for n = 20: in small samples a rule such as |z| > 3 can’t flag anything.

Worked examples

A first example: A typing error at a bike-hire stand

Fictional figures

Gorsefield Bike Hire records the hours of sunshine and the number of hires on ten days. Sunshine: 2, 3, 4, 4, 5, 6, 6, 7, 8 and 9 hours; hires: 14, 18, 17, 22, 21, 26, 230, 27, 30 and 31. CORREL gives r = 0.177. Is sunshine only weakly related to hires?

  1. Plot or scan the data: nine days have between 14 and 31 hires, and day 7 has 230 at 6 hours of sunshine, an ordinary x. It is an outlier in y only, and far off the pattern of the others.
  2. Screen with z-scores: 230 has z = 2.84, which a rule of |z| > 3 would not flag. With n = 10 no z-score can exceed (10 − 1) ÷ √10 = 2.85, so the rule is useless here. The plot and common sense (the stand has never had more than 40 hires in a day) are the checks that work.
  3. Leave one out: without day 7, r = 0.968; leaving out any other day leaves r between 0.110 and 0.263. Day 7 decides the result.
  4. Check the source: the booking system shows 23 hires on day 7. Correct the value and record the change. With 23, r = 0.964 and Spearman’s ρ = 0.957 (ρ was 0.866 with the error).

Answer. No: corrected, sunshine and hires have r = 0.964. The weak r of 0.177 came from one mistyped value (230 for 23).

What it means. Sunny days go with many more hires, as the owner would expect. The lesson is in the method: the z-score rule missed the error, the plot did not, and the correction came from the source rather than from deleting the point.

A harder example: The anatomy of Millbrook’s slip

Fictional figures

In the raw café log, footfall and transactions have r = 0.679 across 612 café-days; one row, Millbrook on 14 September, records a footfall of 2,566. Explain, with z-scores, how one point among 612 can lower r by 0.3, and confirm that correcting it to 256 restores r.

  1. The raw footfall has mean 186.8 and standard deviation 129.9; transactions have mean 94.9 and standard deviation 49.7. The slip’s z-scores are zx=(2566−186.8)÷129.9=18.3z_x = (2566 - 186.8) \div 129.9 = 18.3 and zy=(130−94.9)÷49.7=0.71z_y = (130 - 94.9) \div 49.7 = 0.71.
  2. Its own term in r=∑zxzy÷(n−1)r = \sum z_x z_y \div (n - 1) is 18.3×0.71÷611=0.02118.3 \times 0.71 \div 611 = 0.021: small and positive. The other 611 terms add up to 0.658, and 0.658 + 0.021 = 0.679.
  3. Why are the other terms so small? Without the slip the footfall standard deviation is 87.1, not 129.9. The slip inflates it by a factor of about 1.49, so every other day’s footfall z-score is about a third smaller than it should be, and their sum falls in proportion: 0.981 × 87.1 ÷ 129.9 ≈ 0.66.
  4. Corrected to 256, the day converts 51% of its visitors, like any other Millbrook day, and r = 0.981. Spearman’s ρ barely changes (0.970 with the slip, 0.971 without), because in ranks the slip is simply Millbrook’s busiest day rather than a day ten times busier.

Answer. The slip lowers r from 0.981 to 0.679 mainly by inflating the standard deviation of footfall from 87.1 to 129.9, which shrinks every other day’s contribution; its own contribution is only +0.021.

What it means. An outlier in x that breaks the pattern does most of its damage through the spread, not through its own product. That is why a single error can hide a near-perfect relationship, and why the rank correlation, which ignores the size of the spread, hardly notices it.

Applied: a business decision: Festival days and the peak roster

Fictional figures

Ana is setting next year’s rule for rostering Harbourside’s 7–11 a.m. peak, and asks how closely footfall goes with the peak wait. Across all 306 days r = 0.673; the five festival days had footfalls of 502 to 620 and waits of 4.7 to 15.3 minutes. What should she report?

  1. Check the festival days at the source: the door counter, the till and the roster all confirm them. They are genuine, so they stay in the log.
  2. Measure their influence: without the five days r = 0.476 (301 days); leaving out 29 May alone gives 0.595. Spearman’s ρ is 0.420 with them and 0.391 without, so in ranks the festivals matter much less.
  3. Ask what the question is about. The roster rule is for ordinary days, and festival days are planned separately, with extra staff rostered for each one. For ordinary days the relevant figure is 0.48; the 0.67 is largely five days of crowds.
  4. Write both down: “Across all 306 days footfall and the peak wait have r = 0.67; without the five festival days, which are rostered separately, r = 0.48. On ordinary days busier mornings go with longer waits, but footfall alone leaves most of the variation in waits unexplained.”

Answer. Report r = 0.48 for ordinary days as the figure for the roster rule, with r = 0.67 for all days beside it and the reason for the difference.

What it means. Neither number is the “true” one; they answer different questions. The festival days show what extreme crowds do to waits, which matters for festival planning; the ordinary days show the everyday link, which matters for the weekly roster. Waits depend on how many customers each barista serves, not on footfall alone: the partial-correlation lesson shows what happens when staffing is taken into account.

Explore

The raw log: footfall against transactions for all 612 café-days. Find the point far to the right, then use the buttons to leave out the points that move r most. Leaving out the first one (the slip) moves r from 0.679 to 0.981; the next buttons barely move it. Tick “Plot ranks” to see why Spearman’s ρ hardly noticed.

Loading the interactive…

Harbourside’s 306 days: footfall against the peak wait. Colour the points by festival day and look at the five far to the right. Leave them out one at a time and watch r fall from 0.673 to about 0.48 (0.476 with exactly the five festival days left out). Which ordinary day is the most influential, and why might it have had such a long wait?

Loading the interactive…

Twenty Millbrook days, 1–20 September, as they were typed. F1 is Pearson’s r, F2 Spearman’s ρ (Pearson’s r of the ranks) and column D the conversion rate. Find the row whose conversion is impossible, type the door counter’s value, 256, into B15, and watch both correlations move.

Loading the interactive…

Common mistakes

  • “The correlation is weak, so the two things are only loosely related.”

    A single error can turn r = 0.98 into r = 0.68. Before interpreting the size of r, plot the data and look for points that sit apart. A correlation is a summary of the plot, not a replacement for it.

  • “No value has |z| above 3, so there are no outliers.”

    In a sample of 10 no z-score can exceed 2.85, however wild the value, because the outlier inflates the standard deviation. And a point can be ordinary on each variable yet unusual in combination. Plot the pairs and use plausibility checks such as conversion rates.

  • “That point is an outlier, so I deleted it.”

    Outliers are not errors by definition. Delete or correct a value only when the source shows it is wrong; keep genuine extremes and report the correlation with and without them. Removing points because the result looks better without them is choosing the answer.

  • “Removing the point changed r a lot, so the point must be an error.”

    Influence measures how much a point matters, not whether it is right. Harbourside’s 29 May festival is the most influential day for footfall and waits, and it is entirely genuine. Check the source, not the size of the change.

  • “I’ll switch to Spearman’s ρ and the outlier problem goes away.”

    Ranks limit how far one point can pull, which makes ρ a useful check, but an error still counts as an observation: in 20 Millbrook days the slip lowers ρ from 0.941 to 0.810. Correct errors first; use ranks to show how much the conclusion depends on a few genuine extremes.

Guided practice

Work through these with hints when you need them. Every hint and every worked solution is there to be used.

Loading four questions…

On your own

No hints this time. Answer, check, and read the feedback; the solution appears once you have answered or if you ask for it. Your first answers count toward mastery.

Loading six questions…

In practice

Fictional case

Ana’s note in the log’s cleaning record: “14 Sep 2027, Millbrook, footfall: typed 2,566; door counter export says 256. Corrected. With the error, footfall and transactions had r = 0.68; corrected, 0.98. Festival days (5, Harbourside) checked against the till and kept. Correlations involving footfall at Harbourside are reported with and without them.”

Analysts who work with operational data meet outliers every week, and the ones who are trusted handle them in the same order every time. They plot the data before computing anything. They screen each variable and check every row against rules the business makes obvious: conversion rates, ranges, totals that must add up. They look at leave-one-out changes, or at the few points that move a result most, to see which points matter. Then they go to the source for each of those points and decide, on the evidence, whether it is an error, and they record what they did.

Reporting both ways is the habit that matters most. A finding that depends on five festival days is a different finding from one that holds on ordinary days, and the people who act on it need to know which they are getting. In a short report that can be one sentence: “r = 0.67 across all days; 0.48 excluding the five festival days.” A reader can then judge for themselves, and nobody can say that inconvenient days were quietly dropped.

Two traps are worth naming in a team’s working rules. The first is a rule that removes every point beyond |z| = 3 automatically: it removes genuine extremes along with errors, misses errors in small samples, and lets the analyst off looking at the data. The second is checking for outliers only when a result disappoints. Apply the same checks whichever way the result goes, decide what to do before seeing what each choice does to r, and the result will survive a sceptical reader.

Knowledge check

Six questions, one attempt each, no hints. Score 80% or more to complete the lesson; you can take it again at any time.

Loading six questions…

Summary

  • One point can move a correlation a long way: Millbrook’s mistyped footfall (2,566 for 256) lowered r for footfall and transactions from 0.981 to 0.679 across 612 café-days.
  • Where a point sits decides what it does: far out in x and y on the trend raises r; far out in y only, or far out in x off the trend, lowers it.
  • An outlier off the trend damages r mostly by inflating a standard deviation, which shrinks every other point’s z-score; its own term, z_x z_y ÷ (n − 1), can be small.
  • Leave-one-out changes, r₍₋ᵢ₎ − r, show which points matter. Influence is not error: the most influential genuine day still belongs in the data.
  • Find outliers with a plot, per-variable screens and business plausibility checks; in small samples z-scores cannot reach 3 (|z| ≤ (n − 1) ÷ √n).
  • Correct errors from the source and record the change; keep genuine extremes and report the correlation with and without them; use Spearman’s ρ as a robustness check; never delete points because the result looks better without them.

Key formulas

Terms introduced

Influential point
A data point whose removal would change a result, such as a correlation or a fitted line, noticeably. Influence measures how much a point matters, not whether it is correct.
Leave-one-out analysis
Recomputing a result once for each observation with that observation removed, to see how much each one changes the result.
Bivariate outlier
A pair of values that lies far from the pattern of the other pairs, whether or not either value is extreme on its own.
Plausibility check
A test of a value against a rule the business or the physical world makes obvious, such as a conversion rate between 0 and 1 or a wait that cannot be negative, used to find recording errors.

Sources

  1. Illowsky, B. & Dean, S. Introductory Statistics 2e, section 12.6, “Outliers”. OpenStax. openstax.org/books/introductory-statistics-2e/pages/12-6-out…
  2. NIST/SEMATECH. e-Handbook of Statistical Methods, section 7.1.6, “What are outliers in the data?”. itl.nist.gov/div898/handbook/prc/section1/prc16.htm
  3. NIST/SEMATECH. e-Handbook of Statistical Methods, section 1.3.3.26, “Scatter Plot” (including the outlier sample plot). itl.nist.gov/div898/handbook/eda/section3/eda33q.htm
  4. Microsoft Support. “CORREL function”. support.microsoft.com/en-US/excel/functions/correl-function