Correlation Calculator — Pearson r, R² & Step-by-Step Breakdown (Free Online Tool)

Keep observations paired and use a scatter plot to interpret the sign and size of a correlation.

Quick Answer

His student Karl Pearson gave it mathematical rigour in 1895–1896, deriving what we now call Pearson's r — the standard measure of correlation in modern statistics.

Scatter plot of paired observations on graph paper

Correlation Calculator — Pearson r, R², & Step-by-Step Breakdown (Free Online Tool)

Statistics Pearson's r Correlation Coefficient R² Bivariate Analysis Data Science

The Pearson correlation coefficient is one of the most important numbers in all of statistics. It tells you in a single value — ranging from −1 to +1 — how strongly two variables move together and in which direction. Whether you're a student checking your dataset for a school project, a researcher exploring relationships in survey data, or a data analyst building a predictive model, knowing how to calculate and interpret correlation is a foundational skill.

The HeLovesMath Free Correlation Calculator computes Pearson's r and R² instantly from any two paired datasets you enter. No spreadsheet, no textbook, no manual arithmetic required. This guide also teaches you exactly what correlation means, derives the formula from first principles, covers Spearman and Kendall alternatives, discusses the classic pitfalls (correlation ≠ causation, Anscombe's Quartet), and provides four fully worked numerical examples with every step shown.

Free Online Pearson Correlation Calculator

Pearson Correlation Calculator — r & R² Instantly

Enter comma-separated paired values for X and Y. Results appear after clicking Calculate.

Enter numbers separated by commas. At least 2 pairs required. Must contain exactly the same number of values as X.
Correlation Results
Pearson r
—
R² (Coeff. of Det.)
—
R² as %
—
Interpretation: —

What Is Correlation? — Measuring Linear Association

Correlation is a statistical measure that describes the degree to which two variables move in relation to each other. More precisely, it quantifies the strength and direction of the linear association between two continuous variables. The word comes from the Latin correlatio — "mutual relation."

The concept was formalised by Sir Francis Galton in the 1880s while studying the relationship between heights of parents and children (a phenomenon he called "regression towards mediocrity"). His student Karl Pearson gave it mathematical rigour in 1895–1896, deriving what we now call Pearson's r — the standard measure of correlation in modern statistics.

Positive Correlation

As X increases, Y tends to increase too. The scatterplot shows points rising from lower-left to upper-right. Examples: height and weight, study hours and test scores, income and spending.

Negative Correlation

As X increases, Y tends to decrease. Points fall from upper-left to lower-right. Examples: temperature and heating bill, price of a product and demand, hours of TV watched and exam results.

➡ Zero Correlation

No systematic linear relationship — points scatter randomly. r ≈ 0. Note: r = 0 does NOT mean no relationship exists; there could be a strong non-linear (e.g., curved) relationship that r fails to detect.

Critical Warning: Pearson's r only detects linear relationships. A perfect U-shaped (quadratic) relationship between X and Y can give r = 0, leading you to falsely conclude "no relationship exists." Always visualise your data with a scatterplot before relying on r.

Pearson Correlation Formula — Derived & Explained

There are several equivalent ways to write the Pearson correlation formula. We'll present all of them, starting from the most conceptually meaningful and ending with the computationally convenient form used by this calculator.

Conceptual Definition — Standardised Covariance

Pearson's r is defined as the covariance of X and Y divided by the product of their standard deviations:

✦ Pearson r — Population Formula
\[\rho_{XY} = \frac{\text{Cov}(X,Y)}{\sigma_X \sigma_Y} = \frac{E[(X-\mu_X)(Y-\mu_Y)]}{\sigma_X \sigma_Y}\]
ρ = population correlation coefficient  |  Cov(X,Y) = population covariance  |  σ_X, σ_Y = population standard deviations  |  μ_X, μ_Y = population means  |  This formula shows r as the standardised version of covariance, making it dimensionless and bounded in [−1, +1].
✦ Pearson r — Sample Formula (z-score form)
\[r = \frac{1}{n-1}\sum_{i=1}^{n}\left(\frac{x_i - \bar{x}}{s_x}\right)\!\left(\frac{y_i - \bar{y}}{s_y}\right)\]
n = sample size  |  x̄, ȳ = sample means  |  s_x, s_y = sample standard deviations  |  This form makes clear that r is the average product of z-scores — it measures how much X and Y deviate from their means in the same direction simultaneously.

Computational Formula (used by this calculator)

Expanding the z-score formula algebraically yields a form that avoids computing the means first — ideal for hand calculation and computer implementation:

✦ Pearson r — Computational Formula
\[r = \frac{n\!\sum x_i y_i - \!\sum x_i \!\sum y_i}{\sqrt{\!\left(n\!\sum x_i^2 - \!\left(\!\sum x_i\right)^{\!2}\right)\!\left(n\!\sum y_i^2 - \!\left(\!\sum y_i\right)^{\!2}\right)}}\]
n = number of data pairs  |  Σxᵢyᵢ = sum of all products xᵢyᵢ  |  Σxᵢ = sum of all x values  |  Σyᵢ = sum of all y values  |  Σxᵢ² = sum of all x² values  |  Σyᵢ² = sum of all y² values

Understanding What Makes r = ±1

By the Cauchy-Schwarz inequality, |r| ≤ 1 always. Equality |r| = 1 holds when all data points lie exactly on a straight line. If the line has positive slope, r = +1; negative slope, r = −1. This is the mathematical guarantee that r is always bounded between −1 and +1.

✦ Pearson r in terms of Covariance and Standard Deviations
\[r = \frac{S_{xy}}{S_{xx}\cdot S_{yy}} \quad \text{where} \quad S_{xy} = \sum x_i y_i - \frac{(\sum x_i)(\sum y_i)}{n}\] \[S_{xx} = \sum x_i^2 - \frac{(\sum x_i)^2}{n}, \quad S_{yy} = \sum y_i^2 - \frac{(\sum y_i)^2}{n}\]
S_xy = corrected sum of cross-products (numerator of sample covariance × (n−1))  |  S_xx = corrected sum of squares for X  |  S_yy = corrected sum of squares for Y

Coefficient of Determination R² — How Much Variance Is Explained?

✦ Coefficient of Determination
\[R^2 = r^2\]
R² ranges from 0 to 1 (or 0% to 100%). It represents the proportion of the total variance in Y that is associated with (linearly "explained" by) variance in X. Example: r = 0.85 → R² = 0.7225 → 72.25% of variance in Y is associated with X.

R² is arguably more interpretable than r because it has a direct percentage interpretation. Consider these examples:

Pearson rR²% Variance ExplainedInterpretation
±1.001.000100%Perfect linear fit
±0.900.81081.0%Very strong — excellent prediction
±0.800.64064.0%Very strong
±0.700.49049.0%Strong — around half variance explained
±0.600.36036.0%Moderate-strong
±0.500.25025.0%Moderate
±0.300.0909.0%Weak
0.000.0000%No linear relationship

Interpreting r — Strength, Direction & Context

There is no single universal scale for interpreting r strength — the appropriate benchmark depends heavily on your field of study. Cohen (1988) proposed guidelines for social sciences; medical research often requires much higher r to be practically meaningful.

−1 (Perfect Neg.)−0.50+0.5+1 (Perfect Pos.)
Very Strong Neg. Weak/Mod. None Weak/Mod. Very Strong Pos.
|r| RangeCohen (Social Science)Medical/ClinicalPhysical Sciences
0.8 – 1.0Very StrongVery StrongOften expected
0.6 – 0.8StrongModerate-StrongModerate
0.4 – 0.6ModerateModerateWeak-Moderate
0.2 – 0.4WeakWeakVery Weak
0.0 – 0.2Very Weak / NoneNegligibleEssentially zero
Field Context Matters: In psychology and social sciences, r = 0.30 is often considered a respectable finding. In physics or engineering, r = 0.99 might be the minimum acceptable. Always interpret correlation in the context of your field and the complexity of the phenomenon being measured.

Assumptions of Pearson's Correlation

1. Linearity

The relationship between X and Y must be approximately linear. Pearson's r measures only linear association. If the true relationship is curved (e.g., quadratic or exponential), r will underestimate the true relationship strength. Check with a scatterplot.

2. Bivariate Normality

Both X and Y should be approximately normally distributed. This is important mainly for hypothesis testing (significance of r) and confidence intervals. With large samples (n ≥ 30), the Central Limit Theorem makes this assumption less critical.

3. Homoscedasticity

The variance (spread) of Y values should be roughly constant across all levels of X — this is called homoscedasticity (equal scatter). If the data "fans out" as X increases (heteroscedasticity), Pearson's r may be misleading.

4. No Extreme Outliers

Outliers can dramatically inflate or deflate r. A single extreme data point can cause a genuinely uncorrelated dataset to appear strongly correlated, or wash out a true strong correlation. Always inspect your scatterplot for outliers before reporting r.

5. Paired Observations

Each X value must be paired with exactly one Y value — they must come from the same observational unit. You cannot pair 10 random X values with 10 random Y values from different subjects and expect r to be meaningful.

6. Independence

For valid statistical inference, each pair (xᵢ, yᵢ) should be independent of all other pairs. Time-series data or repeated measures on the same individual can violate this, inflating or deflating the apparent correlation.

Is My Correlation Statistically Significant? — The t-Test for r

A correlation r computed from a sample may differ from zero purely by chance. The significance test asks: "If the true population correlation ρ = 0, how likely am I to observe an r at least this extreme by random sampling?"

✦ t-Test Statistic for Pearson r
\[t = \frac{r\sqrt{n-2}}{\sqrt{1-r^2}} \quad \sim\; t_{n-2}\]
t = test statistic (compared to t-distribution with n−2 degrees of freedom)  |  r = sample Pearson correlation coefficient  |  n = sample size  |  Reject H₀: ρ=0 if |t| > t_critical at chosen significance level α.
Fisher's z-transformation for confidence intervals: \(z_r = \frac{1}{2}\ln\!\left(\frac{1+r}{1-r}\right) = \text{arctanh}(r)\). This transforms r to a nearly normal variable: \(z_r \sim \mathcal{N}\!\left(\text{arctanh}(\rho),\; 1/\sqrt{n-3}\right)\), allowing the construction of confidence intervals for r that can then be back-transformed via \(r = \tanh(z_r)\).

A key caution: with large samples, even tiny correlations become statistically significant. r = 0.05 with n = 2,000 is statistically significant at p < 0.05 — but explains only 0.25% of the variance, making it practically meaningless. Always report both the correlation value and the sample size, not just the p-value.

Pearson vs. Spearman vs. Kendall — Which Correlation to Use?

PropertyPearson rSpearman ρKendall τ
Data typeContinuous, Interval/RatioOrdinal or continuousOrdinal or continuous
Relationship typeLinear onlyMonotonicMonotonic
Normality required?For inference, yesNo (non-parametric)No (non-parametric)
Outlier robustnessLowHighVery High
InterpretationMost intuitiveRank-basedConcordance-based
Typical |value| vs Pearson—Slightly lowerNoticeably lower
Best for small samplesIf normalOKBest
✦ Spearman's Rank Correlation ρ
\[\rho = 1 - \frac{6\sum d_i^2}{n(n^2-1)}\]
dᵢ = rank(xᵢ) − rank(yᵢ) = difference in ranks for the i-th pair  |  This simplified formula applies when there are no tied ranks. With ties, the full Pearson formula applied to ranks is used instead.
✦ Kendall's τ
\[\tau = \frac{C - D}{\frac{1}{2}n(n-1)}\]
C = number of concordant pairs (both X and Y increase or both decrease together)  |  D = number of discordant pairs (one increases while the other decreases)  |  Denominator = total number of pair comparisons = n(n−1)/2

Correlation ≠ Causation & Anscombe's Quartet

The most important lesson in statistics: correlation measures association, not causation. Two variables can be strongly correlated for many reasons that have nothing to do with one causing the other.

Why Correlation ≠ Causation

Common Cause (Confounding)

Ice cream sales and drowning deaths are strongly positively correlated — both increase in hot weather. Neither causes the other; a third variable (temperature / summer) drives both.

Reverse Causation

If sick people take more medicine, correlation between medicine use and illness would appear positive — but illness caused the medicine intake, not the other way round.

Spurious Correlation

Per capita cheese consumption in the US correlates with deaths by bedsheet tangling (r ≈ 0.947). No real relationship exists — this is pure numerical coincidence over time.

Anscombe's Quartet — Why You Must Plot Your Data

In 1973, statistician Francis Anscombe created four famous datasets that all have nearly identical summary statistics — same mean of X, mean of Y, variance of X, variance of Y, correlation r ≈ 0.816, and the same regression line — yet look completely different on a scatterplot:

DatasetrWhat the Scatterplot ShowsAppropriate Analysis
I0.816Genuine linear relationship — Pearson r is appropriateLinear regression
II0.816Perfect curved (quadratic) relationship — r is misleadingPolynomial regression
III0.816Perfect line except ONE extreme outlier — r highly distortedRemove outlier, re-run
IV0.817All X values identical except one — not a real correlationDo not use Pearson r
The Lesson: Anscombe's Quartet proves that r alone can be profoundly misleading. Always create a scatterplot of your data before computing, reporting, or drawing conclusions from a correlation coefficient.

Real-World Applications of Correlation Analysis

Finance & Economics

Portfolio diversification relies on asset correlation. Stocks with low or negative correlations reduce portfolio risk. The correlation matrix of asset returns is central to Modern Portfolio Theory (Markowitz, 1952).

Medical Research

Epidemiologists correlate risk factors (blood pressure, cholesterol) with health outcomes (heart attacks, strokes). Correlation informs which variables to include in multivariate regression models predicting disease risk.

Machine Learning

Correlation matrices help identify redundant features in datasets. Highly correlated features can be dropped to reduce dimensionality and prevent multicollinearity in linear models. Correlation is also used in feature selection for predictive modelling.

Educational Research

Researchers correlate study habits, socioeconomic factors, and teaching methods with student performance. r helps identify which inputs most strongly predict outcomes, guiding curriculum design and resource allocation.

Climate Science

Climate scientists correlate atmospheric CO₂ concentration with global mean temperature, sea ice extent, and ocean pH. Long-term correlations over decades provide evidence for climate trends.

Quality Control

Manufacturing engineers correlate process parameters (temperature, pressure, speed) with product quality metrics to identify which process variables most affect output quality, enabling targeted process improvements.

Worked Examples — Pearson r Step by Step

Example 1 — Small Dataset: Study Hours vs. Test Score

Data: X = [2, 3, 5, 7, 8] (study hours), Y = [40, 55, 65, 80, 90] (test score %)

1
n = 5. Σx = 2+3+5+7+8 = 25. Σy = 40+55+65+80+90 = 330.
2
Σxy = (2×40)+(3×55)+(5×65)+(7×80)+(8×90) = 80+165+325+560+720 = 1850.
3
Σx² = 4+9+25+49+64 = 151. Σy² = 1600+3025+4225+6400+8100 = 23350.
4
Numerator = n·Σxy − Σx·Σy = 5×1850 − 25×330 = 9250 − 8250 = 1000.
5
Denom Part 1 = n·Σx² − (Σx)² = 5×151 − 625 = 755 − 625 = 130.
6
Denom Part 2 = n·Σy² − (Σy)² = 5×23350 − 108900 = 116750 − 108900 = 7850.
7
Denominator = √(130 × 7850) = √1,020,500 ≈ 1010.2.
8
r = 1000 / 1010.2 ≈ 0.9899. R² = 0.9801 (98.0% of variance in test score explained by study hours).

r ≈ 0.990 — Very Strong Positive linear relationship. Enter this data above to verify.

Example 2 — Negative Correlation: Temperature vs. Hot Drink Sales

Data: X = [5, 10, 15, 20, 25, 30] (°C), Y = [120, 95, 70, 50, 30, 15] (units sold)

1
n=6, Σx=105, Σy=380, Σxy = (5×120)+(10×95)+(15×70)+(20×50)+(25×30)+(30×15) = 600+950+1050+1000+750+450 = 4800.
2
Σx²=5²+10²+15²+20²+25²+30² = 25+100+225+400+625+900 = 2275. Σy²=14400+9025+4900+2500+900+225 = 31950.
3
Num = 6×4800 − 105×380 = 28800 − 39900 = −11100. (Negative → negative correlation ✓)
4
D1 = 6×2275 − 105² = 13650 − 11025 = 2625. D2 = 6×31950 − 380² = 191700 − 144400 = 47300.
5
Denom = √(2625 × 47300) = √124,162,500 ≈ 11142. r = −11100/11142 ≈ −0.9962.

r ≈ −0.996 — Very Strong Negative. R² ≈ 0.992 (99.2% explained). Temperature strongly predicts hot drink sales.

Example 3 — Weak Correlation: Shoe Size vs. IQ

Data: X = [7, 8, 9, 10, 11] (shoe size UK), Y = [105, 98, 112, 101, 108] (IQ score)

1
n=5, Σx=45, Σy=524, Σxy = 735+784+1008+1010+1188 = 4725. Σx²=339, Σy²=54954.
2
Num = 5×4725 − 45×524 = 23625 − 23580 = 45.
3
D1 = 5×339 − 2025 = 1695 − 2025 = −330 ... wait, correction: (45)² = 2025, 5×339=1695, D1=1695−2025 = ... D1 should be positive. Re-check: Σx² = 49+64+81+100+121 = 415. D1 = 5×415 − 2025 = 2075−2025 = 50.
4
Σy² = 11025+9604+12544+10201+11664 = 55038. D2 = 5×55038 − 524² = 275190 − 274576 = 614.
5
Denom = √(50 × 614) = √30700 ≈ 175.2. r = 45/175.2 ≈ 0.257.

r ≈ 0.257 — Very Weak positive correlation. R² ≈ 0.066 (only 6.6% of IQ variance associated with shoe size). Essentially no meaningful relationship.

Example 4 — Significance Test: Is r = 0.65 with n = 15 significant at p < 0.05?

1
Given: r = 0.65, n = 15. Degrees of freedom: df = n − 2 = 13.
2
\(t = r\sqrt{n-2}/\sqrt{1-r^2} = 0.65\times\sqrt{13}/\sqrt{1-0.4225} = 0.65\times 3.606/\sqrt{0.5775}\)
3
= 0.65 × 3.606 / 0.7600 = 2.344 / 0.7600 = 3.084.
4
Critical t at α=0.05 (two-tailed), df=13 is t_critical = 2.160. Since 3.084 > 2.160, we reject H₀: ρ=0.

r = 0.65 with n=15 IS statistically significant at p < 0.05. The correlation is unlikely to be due to chance.

Frequently Asked Questions

Pearson's r measures the strength and direction of the linear relationship between two continuous variables. It ranges from −1 (perfect negative linear relationship) to +1 (perfect positive linear relationship), with 0 indicating no linear relationship. Developed by Karl Pearson in 1895, it is the most widely used correlation measure in statistics, research, data analysis, and machine learning.
The computational formula is: \(r = \frac{n\Sigma xy - \Sigma x\Sigma y}{\sqrt{[n\Sigma x^2-(\Sigma x)^2][n\Sigma y^2-(\Sigma y)^2]}}\). The conceptual formula is: \(r = \frac{S_{xy}}{\sqrt{S_{xx}S_{yy}}}\) where S terms are corrected sums of squares/cross-products. Both are algebraically identical. This calculator uses the computational formula because it avoids computing means first.
|r| ≥ 0.8: Very Strong; 0.6–0.8: Strong; 0.4–0.6: Moderate; 0.2–0.4: Weak; 0–0.2: Very Weak/None. The sign indicates direction: positive r means both variables increase together; negative r means one increases as the other decreases. These thresholds are conventions — the appropriate benchmark depends on your field (see the comparison table above).
R² = r². It represents the proportion of variance in Y that is linearly associated with variance in X, expressed as a percentage. Example: r = 0.8 → R² = 0.64 → 64% of variance in Y is "explained" by X. The remaining 36% is due to other factors. R² is more directly interpretable than r for communicating practical effect size.
No — this is the most important caution in statistics. Correlation only establishes statistical association, not causation. Two variables can be correlated because: (1) X causes Y; (2) Y causes X; (3) a third variable causes both; or (4) it's pure coincidence (spurious correlation). Only a properly designed randomised controlled experiment can establish causation. Always think critically about the mechanism before interpreting correlation as evidence of cause and effect.
The main assumptions are: (1) Linearity — the true relationship between X and Y is linear; (2) Bivariate normality — both variables approximately normally distributed (for inference); (3) Homoscedasticity — consistent spread of Y values across X; (4) No significant outliers — extreme values can distort r dramatically; (5) Paired observations — each x paired with exactly one corresponding y; (6) Independence — observations are independent of each other.
Use Spearman's ρ (rank correlation) when: (1) your data are ordinal (ranked but not truly continuous); (2) data are not normally distributed; (3) the relationship is monotonic but not linear; (4) there are significant outliers that you cannot remove. Spearman's ρ ranks both variables and then applies Pearson's formula to the ranks — making it non-parametric and more robust. Formula: \(\rho = 1 - 6\Sigma d^2/[n(n^2-1)]\) where d = rank difference for each pair.
Covariance \(Cov(X,Y) = \Sigma[(x_i-\bar{x})(y_i-\bar{y})]/(n-1)\) measures how two variables vary together in original data units — making it scale-dependent and hard to compare across studies. Pearson's r = Cov(X,Y)/(s_x · s_y) is the standardised version — dimensionless, always in [−1,+1], and directly comparable across different scales and datasets. Think of r as "covariance measured in standard deviation units."
Use the t-test: \(t = r\sqrt{n-2}/\sqrt{1-r^2}\) with df = n−2. Compare the computed t to the critical value from the t-distribution at your significance level α. An alternative uses Fisher's z-transformation for confidence intervals. Important caveat: with very large n, even r = 0.05 becomes statistically significant — always report both r and n, and evaluate practical significance (R²) alongside p-value.
A scatterplot plots each (x, y) pair as a point on a graph — X on the horizontal axis, Y on the vertical. It is the single most important step before computing correlation because it reveals: (1) whether the relationship is actually linear; (2) the presence of outliers; (3) non-linear patterns (curves) that r would miss; (4) data clusters or structural breaks. Anscombe's Quartet (1973) famously shows four datasets with identical r = 0.816 but completely different scatterplot patterns — only one of which is truly appropriate for Pearson's r.
Anscombe's Quartet (1973) is four datasets with nearlyidentical means, variances, correlation r ≈ 0.816, and regression lines — yet completely different scatterplot patterns. Dataset I: genuinely linear. Dataset II: perfect quadratic curve. Dataset III: perfectly linear except one outlier. Dataset IV: all X identical at 8 except one point at 19. The lesson: never rely on summary statistics alone — always plot your data before computing and reporting correlation.
Kendall's τ = (C−D)/[n(n−1)/2] where C = concordant pairs and D = discordant pairs. It is a rank-based correlation that counts how often pairs rank in the same order across both variables. Compared to Spearman's ρ, Kendall's τ produces smaller absolute values but has more accurate p-values for small samples and handles tied values better. Use Kendall's τ for small samples, heavily tied data, or when you need the most robust rank correlation available.
Advertisement

Preserve pairs when sorting data

Three readings give input-output pairs of one and six, two and four, and three and two. As the input rises by one, the output falls by two every time. The points sit on a descending straight line, so their Pearson correlation is minus one. Sorting both columns independently into increasing order would change the apparent relation to plus one by creating pairs that were never observed. Sort whole rows instead. Adding the same constant to every output would move the line vertically but preserve the correlation.

Relationships Between Quantitative Datasets

Before we can evaluate a relationship between two datasets, we must first decide if we feel that one might depend on the other. In our exam example, it is appropriate to say that the score on the final depends on the score on the midterm, rather than the other way around: if the midterm depended on the final, then we’d need to know the final score first, which doesn’t make sense.
Here’s another example: if we collected data on home purchases in a certain area, and noted both the sale price of the house and the annual household income of the purchaser, we might expect a relationship between those two. Which depends on the other? In this case, sale price depends on income: people who have a higher income can afford a more expensive house. If it were the other way around, people could buy a new, more expensive house and then expect a raise! (This is very bad advice.)
It's worth noting that not every pair of related datasets has clear dependence. For example, consider the percent of a country’s budget devoted to the military and the percent earmarked for public health. These datasets are generally related: as one goes up, the other goes down. However, in this case, there’s not a preferred choice for dependence, as each could be seen as depending on the other. When exploring the relationship between two datasets, if one set seems to depend on the other, we’ll say that dataset contains values of the response variable (or dependent variable). The dataset that the response variable depends on contains values of what we call the explanatory variable (or independent variable). If no dependence relationship can be identified, then we can assign either dataset to either role.

Identifying Explanatory and Response Variables

For each of the following pairs of related datasets, identify which (if any) should be assigned the role of response variable and which should be assigned to be the explanatory variable.
  1. A person’s height and weight
  2. A professional basketball player’s salary and their average points scored per game (which is a measure of how good they are at basketball)
  3. The length and width of leaves on a tree
Solution
  1. As people get taller, their weight tends to increase. But if a person goes on a diet and loses weight, we don’t expect them to also get shorter. So, weight depends on height. That means we’ll say that the response variable is weight and the explanatory variable is height.
  2. The more points a basketball player scores, the more money they should make. But if a basketball player gets a raise, we wouldn’t expect them to get better at basketball as a result. So, the response is salary and the explanatory is points per game.
  3. The way that the length and width of leaves are connected isn’t clear. It seems reasonable that as the width goes up, so would the length. But the other direction is also plausible: as the length goes up, so does the width. Without a clear dependence relationship, we’re free to declare either to be the response and the other to be the explanatory.
Once we’ve assigned roles to our two datasets, we can take the first step in visualizing the relationship between them: creating a scatter plot.

Creating Scatter Plots

A scatter plot is a visualization of the relationship between two quantitative sets of data. The scatter plot is created by turning the datasets into ordered pairs: the first coordinate contains data values from the explanatory dataset, and the second coordinate contains the corresponding data values from the response dataset. These ordered pairs are then plotted in the xy-plane. Let's return to our exam example to put this into practice.

Creating Scatter Plots Without Technology

Students are exploring the relationship between scores on the midterm exam and final exam in their math course. Here are some of the scores reported by their classmates:
Name Midterm grade Final grade
Student 1 88 84
Student 2 71 80
Student 3 75 77
Student 4 94 95
Student 5 68 73
Create a scatter plot to visualize the data.
Solution
Step 1: Since it makes more sense to think of the final exam score as being dependent on the midterm exam score, we’ll let the final grade be the response. So, let’s think of these two datasets as a set of ordered pairs, midterm first, final second:
Name (Midterm, Final)
Student 1 (88, 84)
Student 2 (71, 80)
Student 3 (75, 77)
Student 4 (94, 95)
Student 5 (68, 73)
Step 2: Next, let’s make the axes. On the horizontal axis, make sure the range of values is sufficient to cover all of the explanatory data. For our data, that’s 68 to 94. Similarly, the vertical axis should cover all of the response data (73 to 95):
A blank coordinate plane. The horizontal axis ranges from 65 to 95, in increments of 5. The vertical axis ranges from 70 to 100, in increments of 5.
Step 3: Our first point is (88, 84). So, we’ll locate 88 on the horizontal axis, 84 on the vertical axis, and identify the point that’s directly above the first location and horizontally level with the second:
A coordinate plane plots a point. The horizontal axis ranges from 65 to 95, in increments of 5. The vertical axis ranges from 70 to 100, in increments of 5. A horizontal dotted line is drawn at 84. A vertical dotted line is drawn at 88. The two dotted lines intersect at the point (88, 84).
Step 4: Repeat this process to place the other four points on the graph:
Five points are plotted on a coordinate plane. The horizontal axis ranges from 65 to 95, in increments of 5. The vertical axis ranges from 70 to 100, in increments of 5. The points are as follows: (68, 73), (72, 80), (75, 77), (88, 84), and (94, 95). Note: all values are approximate.
Step 5: Finally, label the axes:
Five points are plotted on a coordinate plane. The horizontal axis representing midterm ranges from 65 to 95, in increments of 5. The vertical axis representing final ranges from 70 to 100, in increments of 5. The points are as follows: (68, 73), (72, 80), (75, 77), (88, 84), and (94, 95). Note: all values are approximate.
For large datasets, it’s impractical to create scatter plots manually. Luckily, Google Sheets automates this process for us.

Creating Scatter Plots in Google Sheets

The dataset “NHL19” gives the results of the 2018–2019 National Hockey League season. The columns are team, wins (W), losses (L), overtime losses (OTL), total points (PTS), goals scored by the team (GF), goals scored against the team (GA), and goal differential (the difference in GF and GA). Use Google Sheets to create a scatter plot for GF vs. GA.
Solution
Step 1: Open the dataset in Google Sheets, and click and drag to select the data we want to visualize (in this case, we want the columns for GF and GA; make sure you include those labels in the selection).
Step 2: Next, click on the “Insert” menu, then click “Chart.” Sheets will automatically choose a chart format; if the result isn’t a scatter plot, click on the drop-down menu under “Chart type” in the Chart Editor on the right side of the window and select “Scatter chart.”
Step 3: Next, check that the correct choices were made for the horizontal and vertical axes. In this case, we want to see GF on the vertical axis and GA on the horizontal axis. If Sheets made the wrong choice, we can fix it in the Chart Editor by clicking on the name of the dataset under “X-axis” to open up a dropdown menu, then selecting the variable that should go on the horizontal axis (GA in this case).
Step 4: Now, click on the variable under “Series” and select the one that should go on the vertical axis (GF). If you had to make that change, the axis labels in the graph may also need changing; those labels can be fixed using the “Customize” tab in the Chart Editor under “Chart & axis titles.” Your result should look like this:
A scatter plot titled, GF versus GA. The horizontal axis representing GA ranges from 180 to 320, in increments of 20. The vertical axis representing GF ranges from 190 to 330, in increments of 20. The points are scattered throughout and it lies from 200 to 300 on the horizontal axis and 200 to 290 on the vertical axis.
(data source: www.nhl.com)

Reading and Interpreting Scatter Plots

Scatter plots give us information about the existence and strength of a relationship between two datasets. To break that information down, there are a series of questions we might ask to help us. First: Is there a curved pattern in the data? If the answer is “yes,” then we can stop; none of the linear regression techniques from here to the end of this section are appropriate. diagram and diagram show several examples of scatter plots that can help us identify these curved patterns.
A scatter plot represents a curved pattern. The x-axis ranges from 20 to 120, in increments of 20. The y-axis ranges from negative 100 to 500, in increments of 100. The scatter plot shows points scattered along a curve that passes through the following points: (20, 90), (40, 20), (50, 0), (80, 100), (100, 250), and (120, 500). Note: all values are approximate.
Curved pattern
A scatter plot represents no curved pattern. The x-axis ranges from 30 to 110, in increments of 10. The y-axis ranges from 0 to 140, in increments of 20. The points are scattered throughout and it lies from 30 to 100 on the horizontal axis and 10 to 120 on the vertical axis.
No curved pattern
A scatter plot represents a curved pattern. The x-axis ranges from 30 to 100, in increments of 10. The y-axis ranges from 40 to 120, in increments of 10. The scatter plot shows points scattered along a curve that passes through the following points: (30, 80), (40, 60), (55, 50), (70, 65), (90, 102), (100, 110), and (100, 105). Note: all values are approximate.
Curved pattern
A scatter plot represents no curved pattern. The x-axis ranges from 30 to 110, in increments of 10. The y-axis ranges from 0 to 300, in increments of 50. The points are scattered in linear decreasing order. Some of the points are as follows: (35, 250), (40, 220), (50, 200), (60, 175), (70, 150), (80, 125), (90, 75), and (100, 50). Note: all values are approximate.
No curved pattern
Once we have confirmed that there is no curved pattern in our data, we can move to the next question: Is there a linear relationship? To answer this, we must look at different values of the explanatory variable and determine whether the corresponding response values are different, on average. It's important to look at the values “on average” because, in general, our scatter plots won’t include just one corresponding response point for each value of the explanatory variable (i.e., there may be multiple response values for each explanatory value). So, we try to look for the center of those points. Let’s look again at diagram, but consider some different values for the explanatory variable. Let’s highlight the points whose x-values are around 50 and those that are around 80:
A scatter plot. The x-axis ranges from 30 to 110, in increments of 10. The y-axis ranges from 0 to 300, in increments of 50. The points are scattered in linear decreasing order. Some of the points are highlighted in red and the points are as follows: (50, 290), (48, 195), (48, 200), (49.5, 225), (50, 203), (78, 145), (79, 130), (80, 120), (81, 120), (81, 70), (82, 90), (82.5, 90), (82, 100), and (82, 120). Note: all values are approximate.
Now, we can estimate the middle of each group of points. Let's add our estimated averages to the plot as starred points:
A scatter plot. The x-axis ranges from 30 to 110, in increments of 10. The y-axis ranges from 0 to 300, in increments of 50. The points are scattered in linear decreasing order. Some of the points are highlighted in red and the points are as follows: (50, 290), (48, 195), (48, 200), (49.5, 225), (50, 203), (78, 145), (79, 130), (80, 120), (81, 120), (81, 70), (82, 90), (82.5, 90), (82, 100), and (82, 120). Asterisks are marked at (50, 200) and (80, 120). Note: all values are approximate.
Since those two starred points occur at different heights, we can conclude that there’s likely a relationship worth exploring.
Here’s another example using a different set of data:
A scatter plot. The x-axis ranges from 30 to 110, in increments of 10. The y-axis ranges from 0 to 250, in increments of 50. The points are scattered throughout and it lies from 30 to 105 on the horizontal axis and 50 to 250 on the vertical axis.
Let’s look again at the points near 50 and near 80, and estimate the middles of those clusters:
A scatter plot. The x-axis ranges from 30 to 110, in increments of 10. The y-axis ranges from 0 to 250, in increments of 50. The points are scattered throughout and it lies from 30 to 105 on the horizontal axis and 50 to 250 on the vertical axis. Some of the points are marked in red: (48, 120), (48, 140), (50, 150), (50, 155), (48, 190), (51, 195), (82, 75), (80, 125), (81, 130), (80, 160), (81, 160), (82, 140), (81, 195), (81, 200), and (78, 210). Asterisks are marked at (50, 150) and (80, 170). Note all values are approximate.
Notice that there’s not much vertical distance between our two starred points. This tells us that there’s not a strong relationship between these two datasets.

Positive and Negative Linear Relationships

Another way to assess whether there is a relationship between two datasets in a scatter plot is to see if the points seem to be clustered around a line (specifically, a line that’s not horizontal). The stronger the clustering around that line is, the stronger the relationship.
Once we’ve established that there’s a relationship worth exploring, it’s time to start quantifying that relationship. Two datasets have a positive linear relationship if the values of the response tend to increase, on average, as the values of the explanatory variable increase. If the values of the response decrease with increasing values of the explanatory variable, then there is a negative linear relationship between the two datasets. The strength of the relationship is determined by how closely the scatter plot follows a single straight line: the closer the points are to that line, the stronger the relationship. The scatter plots in diagram to diagram depict varying strengths and directions of linear relationships.
A scatter plot. The x-axis ranges from 30 to 110, in increments of 10. The y-axis ranges from 210 to 290, in increments of 10. The points are arranged in linear decreasing order in a single row. Some of the points are as follows: (32, 288), (40, 280), (60, 260), (70, 250), (90, 230), and (100, 220). Note: all values are approximate.
Perfect negative relationship
A scatter plot. The x-axis ranges from 30 to 110, in increments of 10. The y-axis ranges from 200 to 300, in increments of 20. The points are arranged in linear decreasing order in multiple rows. Some of the points are as follows: (32, 287), (40, 281), (60, 260), (70, 245), (90, 230), and (100, 225). Note: all values are approximate.
Strong negative relationship
A scatter plot. The x-axis ranges from 30 to 110, in increments of 10. The y-axis ranges from 150 to 350, in increments of 50. The points are scattered throughout. Most points lie from 30 to 100 on the horizontal axis and 200 to 300 on the vertical axis.
Weak negative relationship
A scatter plot. The x-axis ranges from 30 to 110, in increments of 10. The y-axis ranges from 0 to 250, in increments of 50. The points are scattered throughout. Most points lie from 30 to 105 on the horizontal axis and 50 to 250 on the vertical axis.
No relationship
A scatter plot. The x-axis ranges from 20 to 110, in increments of 10. The y-axis ranges from 300 to 500, in increments of 20. The points are scattered at the center of the graph. Most points lie from 50 to 90 on the horizontal axis and 340 to 440 on the vertical axis.
Weak positive relationship
A scatter plot. The x-axis ranges from 20 to 110, in increments of 10. The y-axis ranges from 300 to 500, in increments of 20. The points are scattered in linear increasing order in a single row. Some of the points are as follows: (27, 345), (40, 360), (60, 380), (70, 390), (80, 400), and (100, 420). Note: all values are approximate.
Strong positive relationship
A scatter plot. The x-axis ranges from 20 to 110, in increments of 10. The y-axis ranges from 300 to 500, in increments of 20. The points are scattered in linear increasing order in a single row. Some of the points are as follows: (27, 345), (40, 360), (60, 380), (70, 390), (80, 400), and (100, 420). Note: all values are approximate.
Perfect positive relationship
The strength and direction (positive or negative) of a linear relationship can also be measured with a statistic called the correlation coefficient (denoted r). Positive values of r indicate a positive relationship, while negative values of r indicate a negative relationship. Values of r close to 0 indicate a weak relationship, while values close to ±1 correspond to a very strong relationship. Looking again at diagram to diagram, the correlation coefficients for each, in sequential order, are: ‒1, ‒0.97, ‒0.55, ‒0.03, 0.61, 0.97, and 1.
There’s no firm rule that establishes a cutoff value of r to divide strong relationships from weak ones, but ±0.7 is often given as the dividing line (i.e., if r>0.7 or r<-0.7 the relationship is strong, and if -0.7<r<0.7 the relationship is weak).
The formula for computing r is very complicated; it’s almost never done without technology. Google Sheets will do the computation for you using the CORREL function. The syntax works like this: if your explanatory values are in cells A2 to A50 and the corresponding response values are in B2 to B50, then you can find the correlation coefficient by entering “=CORREL(A2:A50, B2:B50)”. (Note that the order doesn’t matter for correlation coefficients; “=CORREL(B2:B50, A2:A50)” will give the same result.)
Let’s put all of this together in an example.

Interpreting Scatter Plots

Consider the four scatter plots below:
  1. A scatter plot shows points arranged in a parabolic path. The x-axis ranges from 30 to 20, in increments of 10. The y-axis ranges from negative 10 to 60, in increments of 10. The points are scattered in the form of an open upward parabola. Some of the points are as follows: (negative 20, 45), (negative 10, 10), (0, 0), (10, 10), and (15, 22). Note: all values are approximate.
  1. A scatter plot shows points arranged in increasing order. The x-axis ranges from 30 to 20, in increments of 10. The y-axis ranges from negative 100 to 150, in increments of 50. The points are scattered in increasing order. Some of the points are as follows: (negative 20, negative 50), (negative 10, 0), (0, 40), (10, 75), and (15, 100). Note: all values are approximate.
  1. A scatter plot shows points arranged in decreasing order. The x-axis ranges from 30 to 20, in increments of 10. The y-axis ranges from negative 20 to 20, in increments of 10. The points are scattered in decreasing order. Some of the points are as follows: (negative 20, 10), (negative 10, 5), (0, 0), (10, negative 5), and (15, negative 15). Note: all values are approximate.
  1. A scatter plot. The x-axis ranges from 30 to 20, in increments of 10. The y-axis ranges from 0 to 40, in increments of 5. The points are scattered throughout and the points lie from negative 20 to 15 on the horizontal axis and 0 to 30 on the vertical axis.
For each of these, answer the following questions:
  1. Is there a curved pattern in the data? If yes, stop here. If no, continue to part b.
  2. Classify the strength and direction of the relationship. Make a guess at the value of r.
Solution
    1. Yes, there is a curved pattern.
    1. No, there’s no curved pattern.
    2. Since the points tend upward as we move from left to right, this is a positive relationship. The points seem pretty closely grouped around a line, so it’s fairly strong. Comparing this scatter plot to those in diagram to diagram, we can see that the relationship is stronger than the one in diagram (r=0.61 ) but not as strong as the one in diagram (r=0.97). So, the value of the correlation coefficient is somewhere between the two. We might guess that r=0.9.
    1. No, there’s no curved pattern.
    2. Since the points tend downward as we move from left to right, this is a negative relationship. The points are not tightly grouped around a line, but the pattern is clear. It looks like it has approximately the same strength as the plot in diagram, just with the opposite sign. So, we might guess that r=-0.6.
    1. No, there’s no curved pattern.
    2. Since the points don’t really tend upward or downward as we move from left to right, there is no real relationship here. Thus, r≈0.

Finding the Correlation Coefficient

The data that were plotted in the previous example can be found in the dataset “correlationcoefficient1”. All of them share the same values for the explanatory variable x. The four responses are labeled y1 through y4 . Compute the correlation coefficients for each, if appropriate, using Google Sheets. Round to the nearest hundredth.
Solution
Step 1: There is a curved pattern in the data, so the correlation coefficient isn’t meaningful.
Step 2: Using “=CORREL(A2:A101, C2:C101)” we get r=0.89.
Step 3: Using “=CORREL(A2:A101, D2:D101)” we get r=-0.66.
Step 4: Using “=CORREL(A2:A101, E2:E101)” we get r=-0.04.