Correlation — How Two Variables Move Together

Measuring the strength of a linear relationship

Mathematics Statistics intermediate 6 min

This concept builds on Linear Regression — The Line of Best Fit. Consider exploring it first for the best experience.

Step 1 of 7

Two Variables, One Relationship

Correlation measures how two variables move together. Does taller height mean heavier weight? Do more hours studied lead to higher scores? A scatter plot reveals the pattern: each dot is one case, placed across by its X value and up by its Y value. Watch the 60 dots appear one at a time — even before any number is shown, you can see whether the cloud leans up, leans down or has no lean at all.

The Pearson Coefficient r

r ranges from −1 to +1. r=+1 is perfect positive correlation (both go up together). r=−1 is perfect negative. r=0 means no linear relationship at all. The line drawn through the cloud is the best-fit straight line, and the label beside it shows the current r. Under the hood, r multiplies each point's distance from the mean of X by its distance from the mean of Y, adds these products and scales the total so it cannot leave the −1 to +1 range.

Positive Correlation

When r > 0, high values of X tend to pair with high values of Y. The scatter plot tilts upward. Watch the points arrange themselves into a rising pattern. Points in the upper-right and lower-left of the centre add positive products to r; points in the other two corners subtract. The thinner and more tightly the cloud hugs its line, the closer r gets to +1.

Negative Correlation

When r < 0, high X pairs with low Y. The plot tilts downward. Classic examples: temperature vs. heating bills, study time vs. errors, speed vs. fuel efficiency. Notice that the sign of r only tells you the direction of the tilt; the size of r tells you how tightly the dots cluster around the line. A gentle downward slope with tightly packed points can have a larger |r| than a steep but scattered one.

No Correlation

When r ≈ 0, there is no straight-line trend: the cloud of points is round, not elongated. Drag the slider to see the shape transition, and watch the "R² (Explained)" card fall towards 0%. But r ≈ 0 does not mean "no relationship" — choose "Curved (U-shape)" from the "Data pattern" menu: Y follows X closely along a curve, yet r stays near 0, because the falling left half and the rising right half cancel out.

Correlation ≠ Causation

High r only means the variables move together — not that one causes the other. Ice cream sales and drowning rates are correlated (both peak in summer). Always ask: what's the third variable? Choose "Two hidden groups" from the "Data pattern" menu: each group slopes downward, yet the pooled r is positive. To show that X really changes Y you need a controlled experiment, where X is set on purpose and everything else is held fixed.

One Point Can Swing r

Correlation is sensitive to outliers. Try dragging a single point far from the cloud — watch r shift dramatically even though 59 other points barely moved. Click "New Sample" to redraw 60 fresh points at the same target r and see how much the actual sample r wobbles around it — real data rarely matches its population r exactly. Then click "New Challenge", set "Your guess" and press "Check Guess" to test how well you read r by eye.

How It Works — Step by Step

Step 1 of 7
  1. 1

    Two Variables, One Relationship

    Correlation measures how two variables move together. Does taller height mean heavier weight? Do more hours studied lead to higher scores? A scatter plot reveals the pattern: each dot is one case, placed across by its X value and up by its Y value. Watch the 60 dots appear one at a time — even before any number is shown, you can see whether the cloud leans up, leans down or has no lean at all.

  2. 2

    The Pearson Coefficient r

    r ranges from −1 to +1. r=+1 is perfect positive correlation (both go up together). r=−1 is perfect negative. r=0 means no linear relationship at all. The line drawn through the cloud is the best-fit straight line, and the label beside it shows the current r. Under the hood, r multiplies each point's distance from the mean of X by its distance from the mean of Y, adds these products and scales the total so it cannot leave the −1 to +1 range.

  3. 3

    Positive Correlation

    When r > 0, high values of X tend to pair with high values of Y. The scatter plot tilts upward. Watch the points arrange themselves into a rising pattern. Points in the upper-right and lower-left of the centre add positive products to r; points in the other two corners subtract. The thinner and more tightly the cloud hugs its line, the closer r gets to +1.

  4. 4

    Negative Correlation

    When r < 0, high X pairs with low Y. The plot tilts downward. Classic examples: temperature vs. heating bills, study time vs. errors, speed vs. fuel efficiency. Notice that the sign of r only tells you the direction of the tilt; the size of r tells you how tightly the dots cluster around the line. A gentle downward slope with tightly packed points can have a larger |r| than a steep but scattered one.

  5. 5

    No Correlation

    When r ≈ 0, there is no straight-line trend: the cloud of points is round, not elongated. Drag the slider to see the shape transition, and watch the "R² (Explained)" card fall towards 0%. But r ≈ 0 does not mean "no relationship" — choose "Curved (U-shape)" from the "Data pattern" menu: Y follows X closely along a curve, yet r stays near 0, because the falling left half and the rising right half cancel out.

  6. 6

    Correlation ≠ Causation

    High r only means the variables move together — not that one causes the other. Ice cream sales and drowning rates are correlated (both peak in summer). Always ask: what's the third variable? Choose "Two hidden groups" from the "Data pattern" menu: each group slopes downward, yet the pooled r is positive. To show that X really changes Y you need a controlled experiment, where X is set on purpose and everything else is held fixed.

  7. 7

    One Point Can Swing r

    Correlation is sensitive to outliers. Try dragging a single point far from the cloud — watch r shift dramatically even though 59 other points barely moved. Click "New Sample" to redraw 60 fresh points at the same target r and see how much the actual sample r wobbles around it — real data rarely matches its population r exactly. Then click "New Challenge", set "Your guess" and press "Check Guess" to test how well you read r by eye.

Key Takeaways

r Is Bounded by −1 and +1

|r| = 1 means perfect linear relationship. |r| = 0 means none. In practice, |r| > 0.7 is considered strong, 0.3–0.7 moderate, < 0.3 weak.

Shape of the Scatter Plot

Strong correlation → elongated ellipse. Weak correlation → circular cloud. Negative r → ellipse tilts downward. A curved or clustered cloud can hide a strong relationship behind a small or misleading r, so always look at the plot as well as the number.

R² Tells You Explained Variance

r² (r-squared) is the fraction of variance in Y explained by X. r=0.8 → r²=0.64 → X explains 64% of Y's variance.

Correlation ≠ Causation

Correlation is symmetric (r(X,Y) = r(Y,X)) and observational. Causation requires experimental design. Never skip this distinction.

Added
Updated
  • — Fuller step explanations of how each point pushes r up or down, plus a link to z-scores.
  • — Added a "Data pattern" menu (curved and two-group data) and a "Guess r" challenge, with two new quiz questions.