Words like "strong" or "weak" are too fuzzy to compare scatterplots by eye, so we need a single number that measures the direction and strength of a linear relationship.
1
Measuring How Variables Move Together
The correlation r is a single number that measures how closely two quantitative variables follow a straight line. To build it, we first mark the center of the scatterplot at the mean of the horizontal values and the mean of the vertical values, (xˉ,yˉ), which splits the graph into four quadrants.
Quadrants and Products of Steps from the Mean
From the center (xˉ,yˉ), every point (x,y) has a horizontal step x−xˉ and a vertical step y−yˉ. Multiplying those two steps gives the signed area of the rectangle between the point and the center:
horizontal step(x−xˉ)⋅vertical step(y−yˉ)=⎩⎨⎧(+)(−)in the top-right (+)(+) and bottom-left (−)(−)in the top-left (−)(+) and bottom-right (+)(−)
Now let's test how those positive and negative rectangles add up across a cloud of points.
A point's horizontal and vertical steps from the center make a rectangle whose area is positive when both steps have the same sign, and negative when their signs are opposite.
2
Standardizing Steps with Z-Scores
Multiplying the raw steps (x−xˉ)(y−yˉ) has a problem: if we change apartment size from square meters to square feet, the steps and their products get much larger even though the relationship hasn't changed at all. To remove the units before we multiply, we divide each step by its sample standard deviation (sx or sy) to turn every coordinate into a z-score:
zx=sxx−xˉ,zy=syy−yˉ
Standardizing with Z-Scores to Define Correlation r
Once every point is written in standard deviations from the center as (zx,zy), we multiply zxzy for each point and average them by dividing by n−1 (matching the n−1 used inside sx and sy):
r=n−1∑zxzy
Because the average of z2 across any dataset is n−1∑z2=1, the correlation r can never go past +1 or −1:
−1≤r≤+1
Note that the − sign on r only tells you the line slopes downhill, not that the relationship is weaker. An r of −0.95 is a much stronger linear relationship than +0.60.
3
Calculating Correlation Step by Step
Now let's calculate r from raw data for n=5 students, comparing hours studied (x) and quiz score out of 10 (y):
A (1,2),B (3,6),C (5,4),D (5,6),E (6,7)
Calculating Correlation Step by Step
Text solution
1. Find the center (xˉ,yˉ) from the two meansAverage the 5 horizontal values and the 5 vertical values to find the center of the cloud.
xˉ=51+3+5+5+6=520=4 hours
yˉ=52+6+4+6+7=525=5 points
2. Find the sample standard deviations sx and sySquare each point's deviations from the mean, add them up, divide by n−1=4, and take the square root.
sx=5−1(−3)2+(−1)2+12+12+22=416=4=2 hours
sy=5−1(−3)2+12+(−1)2+12+22=416=4=2 points
3. Convert each point to z-scores and multiply zxzyDivide each deviation by its standard deviation to get (zx,zy) and multiply the pair for each student.
A (1,2):zxzy=(21−4)(22−5)=(−1.5)(−1.5)=+2.25
B (3,6):zxzy=(23−4)(26−5)=(−0.5)(+0.5)=−0.25
C (5,4):zxzy=(25−4)(24−5)=(+0.5)(−0.5)=−0.25
D (5,6):zxzy=(25−4)(26−5)=(+0.5)(+0.5)=+0.25
E (6,7):zxzy=(26−4)(27−5)=(+1.0)(+1.0)=+1.00
4. Add the z-score products and divide by n−1Three points in the top-right and bottom-left quadrants add positive products while two in the other quadrants subtract a little, leaving a positive average.
r=5−12.25−0.25−0.25+0.25+1.00=43.00=+0.75
So r=+0.75, which tells us the five students' hours studied and quiz scores have a moderately strong, positive linear relationship.
4
How Changing Axes or Units Affects r
Because r is built purely from multiplied z-scores, we can see right away what happens to r when we swap the axes, change the units of measurement, or stretch the graph vertically.
Key Properties of Correlation
Each property comes straight from the formula r=n−1∑zxzy:
Both variables must be quantitative: You need a mean and a standard deviation to find z-scores, so r does not exist if either variable is categorical (such as neighborhood name or car color).
Swapping x and y leaves r unchanged: Switching the horizontal and vertical axes only reverses the multiplication order, and zxzy=zyzx for every point.
Changing units leaves r unchanged: Converting hours to minutes multiplies every step x−xˉ and the standard deviation sx by 60, which cancels out inside zx=sxx−xˉ.
If you stretch or squish the vertical axis so the cloud looks steeper or flatter, yˉ and sy scale by the exact same factor, so the (zx,zy) plot and r don't change at all.
Stretching or squishing the vertical scale changes the cloud's steepness, vertical average, and vertical spread together, leaving every z-score and the correlation unchanged.
5
Matching Scatterplots to r and Interpreting in Context
To match scatterplots to their correlation values, or to write an interpretation of r for a real dataset, we read the sign and the size of r one at a time.
Matching Scatterplots to r and Interpreting Correlation
Text solution
1. Group by sign for directionPair the positive r values with the uphill scatterplots and the negative r values with the downhill scatterplots.
2. Rank by distance from 0 toward ±1 for tightnessWithin each pair, match the value closer to +1 or −1 to the tighter linear cloud and the value closer to 0 to the looser cloud.
When a question asks you to interpret r=+0.75, don't just write "moderately strong positive correlation." Connect the strength (from the size 0.75), the direction (from the + sign), the linear form, and both variables in context:
> An r of +0.75 indicates a moderately strong, positive, linear association between hours studied and quiz score: students who studied more hours tended to earn higher scores on the quiz.
6
What Can Fool Correlation: Curves, Outliers, and Lurking Variables
Because r summarizes an entire scatterplot as a single average, three situations can mislead you if you don't check the graph and the context first.
What Can Fool Correlation: Curves, Outliers, and Lurking Variables
Curved relationships can cancel to r=0: If plant growth rises with water up to an ideal amount and then falls when the plant gets too much water, the positive total of the zxzy products on the rising left side can cancel the negative total on the falling right side. An r near 0 only means "no straight-line relationship," not "no relationship."
Correlation does not mean causation: A high correlation like r=+0.85 between monthly ice cream sales and shark attacks only shows that both variables tend to rise above their means at the same time. Here, a third lurking variable (summer heat) separately causes both.
Correlation is not resistant to outliers: Because z-scores measure distance from the center, a single extreme point has a huge zxzy product that can change the average n−1∑zxzy a lot all by itself.
Let's see how a single outlier in the top-left or bottom-right quadrant can pull the correlation of a tight uphill cluster down near zero.
One far-off point in an opposite quadrant makes a negative rectangle big enough to cancel out a whole uphill cluster and pull the correlation near zero.
Key concepts
Before calculating or trusting a correlation r, check two conditions: both variables must be quantitative (never use r if a variable is categorical like species name), and the scatterplot should follow a linear pattern without extreme outliers (never use r=0 to claim two variables are unrelated when the graph is curved).
To find r, measure each point's step from the center (xˉ,yˉ) in standard deviations, multiply each pair of z-scores, and average by n−1:
zxzyr=sxx−xˉ,=syy−yˉ,=n−1∑zxzy
Quadrant signs determine the sum
A point with zx=−1.5 and zy=−1.5 sits in the bottom-left quadrant and adds (−1.5)(−1.5)=+2.25, pulling r toward a positive (uphill) value, while a top-left point like (−2.0,+2.0) adds −4.00 and pulls r down.
Sign for direction, size for tightness (−1≤r≤+1)
r=−0.94 is a much tighter linear cluster than r=+0.72 because ∣−0.94∣ is closer to 1; the − sign only tells you the line slopes downhill.
Unitless, symmetric, and unaffected by slope
Converting units (meters to feet), swapping the x and y axes, or stretching an axis leaves every zxzy product and r completely unchanged.
Association, not causation
Even a strong correlation like r=+0.82 only means x and y move together around their means, never that x causes y; always check whether a lurking variable causes both.
7
Practice
1
Match each scatterplot description (A, B, C, D) to its correlation value from the list r=−0.94,r=−0.18,r=+0.72, and r=+0.99: (A) dots rise from left to right in a moderately tight linear cloud; (B) a nearly circular cloud of dots with a faint downward drift; (C) dots fall from left to right, clustered tightly around a straight line; (D) dots lie almost perfectly on an uphill straight line.
Split the four numbers into two pairs by their sign (+ or −) first, then compare how close each number in the pair is to 1 or −1.
First group by sign for direction: the uphill clouds (A and D) must match +0.72 and +0.99, and the downhill clouds (B and C) must match −0.18 and −0.94. Next compare distance from 0 for tightness. Watch out for the common mistake of treating −0.94 as weaker than −0.18 because −0.94<−0.18 on a number line, which swaps B and C. Strength comes from the size ∣−0.94∣=0.94>∣−0.18∣=0.18.A matches r=+0.72, B matches r=−0.18, C matches r=−0.94, and D matches r=+0.99.
2
For a sample of used cars, age x has mean xˉ=5 years and standard deviation sx=2 years, and price y has mean yˉ=$14,000 and standard deviation sy=$3,000. One car in the sample is 1 year old and sells for $20,000. Find zx,zy, and the product zxzy for this car, state which quadrant it sits in relative to (xˉ,yˉ), and explain how it affects the correlation r.
Watch out: subtract value−mean, not mean−value; doing 5−1 gives zx=+2.0, which puts the car in the wrong quadrant and flips the product to +4.0.
Find the signed step from the mean (x−xˉ and y−yˉ) first, then divide each by its standard deviation.
Find the z-scores for the car's age x=1 and price y=20,000 (watch out: subtract value−mean, not mean−value; doing 5−1 gives zx=+2.0, which puts the car in the wrong quadrant and flips the product to +4.0):
zxzy=21−5=−2.0,=3,00020,000−14,000=+2.0
Multiply the z-scores:
zxzy=(−2.0)(+2.0)=−4.0
zx=−2.0,zy=+2.0, and zxzy=−4.0; because zx<0 and zy>0, the car sits in the top-left quadrant relative to (xˉ,yˉ) and pulls r toward a negative value
3
Calculate the correlation r step by step for the following n=5 data points: (2,16),(4,8),(6,12),(6,8), and (7,6).
Watch out: dividing the sum −3.00 by n=5 instead of n−1=4 is a common mistake and gives the wrong answer r=−0.60.
After finding (xˉ,yˉ) and (sx,sy), check the sign of each point's zxzy product before adding the five products.
Find the means:
xˉyˉ=52+4+6+6+7=525=5,=516+8+12+8+6=550=10
From the x-deviations (−3,−1,+1,+1,+2) and y-deviations (+6,−2,+2,−2,−4), find the sample standard deviations:
sxsy=5−116=4=2,=5−164=16=4
Find (zx,zy) and the product zxzy for each point:
Add the products and divide by n−1=4 (watch out: dividing the sum −3.00 by n=5 instead of n−1=4 is a common mistake and gives the wrong answer r=−0.60):
r=5−1−2.25+0.25+0.25−0.25−1.00=4−3.00=−0.75
4
Across 30 cities, the correlation between winter coat sales per person (x) and flu cases per 1,000 residents (y) is r=+0.82. Interpret what r=+0.82 means in context, and explain why a store owner is wrong to conclude that buying winter coats causes the flu.
Use the sign and size of +0.82 to describe how the two city measurements move together, then ask what third factor changes during the winter.
(Watch out: don't interpret r=+0.82 as an "82% chance of getting the flu from buying a coat." r is an average of z-score products, not a probability or percentage.) An r of +0.82 indicates a strong, positive, linear association between winter coat sales and flu cases: cities with higher winter coat sales per person tended to have more flu cases per 1,000 residents. However, correlation only measures how closely two variables move together, not why; cold winter weather is a lurking variable that separately increases both coat sales and flu cases.
5
A biologist finds a correlation of r=−0.68 between the altitude in meters where a mountain tree grows (x) and the tree's height in meters (y). How does r change if: (a) both measurements are converted from meters to feet; (b) tree height is plotted on the horizontal axis and altitude on the vertical axis; (c) the biologist tries to find the correlation between altitude and the tree's species name?
Don't multiply −0.68 by 3.28 to get −2.23, which would go past −1.
Check what happens to each tree's zx and zy values under each change, and whether zy can be calculated at all.
(a)Converting meters to feet scales the mean and standard deviation by the same number, leaving every z-score unchanged (don't multiply −0.68 by 3.28 to get −2.23, which would go past −1), so r=−0.68.
(b)Swapping the axes only changes zxzy to zyzx for every point (a downhill cloud still slopes downhill when the axes switch places, so don't flip the sign to +0.68), leaving r=−0.68.
(c)Species name is a categorical variable while r requires both variables to be quantitative, so correlation cannot be calculated.
6
Decide whether each claim is right or wrong and explain why: (a) "Dataset A and Dataset B both have r=+1.0, so the line of dots in Dataset A must be just as steep as the line in Dataset B." (b) "The correlation between the price a theater charges per ticket and total ticket revenue is r=0, which proves ticket price and revenue are unrelated."
For (a), think about what dividing by sy does to the vertical scale; for (b), picture what happens to total revenue as ticket price goes from $0 to an ideal price to $1,000.
(a) WrongDon't confuse r=+1.0 with a slope of +1. Converting to z-scores puts both axes into standard deviations, so a very flat uphill line and a very steep uphill line both have r=+1.0 as long as all points lie right on the line.
(b) WrongDon't treat r=0 as "no relationship of any kind." r=0 only means there is no straight-line relationship; ticket price and revenue can follow a strong curved relationship (rising to a peak at an ideal price, then falling when tickets become too expensive) where the positive total of the products on the left and the negative total on the right cancel to 0.
7
In a dataset of n=11 points, ten points form a random cluster right around the center so the sum of their ten zxzy products is 0.00, while the eleventh point is an extreme outlier at zx=+2.0,zy=+2.0. What is r for all 11 points, what would r become if that single outlier were at zx=−2.0,zy=+2.0 instead (with the other ten products still adding to 0.00), and what property of correlation does this show?
Watch out: dividing by n=11 gives the wrong answer +0.36, and dividing by 10−1=9 from counting only the cluster points gives +0.44.
Add the eleventh point's zxzy product to the sum of the first ten (0.00), then divide by n−1 for the full dataset of 11 points.
At (zx=+2.0,zy=+2.0), the eleventh point has product (+2.0)(+2.0)=+4.00, making the total sum 0.00+4.00=+4.00. Divide by n−1=11−1=10 (watch out: dividing by n=11 gives the wrong answer +0.36, and dividing by 10−1=9 from counting only the cluster points gives +0.44):
r=11−1+4.00=10+4.00=+0.40
If the outlier is at (zx=−2.0,zy=+2.0) instead, its product is (−2.0)(+2.0)=−4.00, changing the correlation to:
r=11−1−4.00=10−4.00=−0.40
r=+0.40 in the first case and r=−0.40 in the second case, which shows that correlation is not resistant to outliers