Live Pearson r

Correlation

Week 8 · what the number r is, and where it leads · step 1 of the modeling arc
Built-in AI tutor. Not sure why a tight line means r near 1, or why a downward cloud is negative? Ask the helper on this page. It coaches toward the answer, it does not just hand it over.

Correlation is one number, written r, that measures how tightly two things move together in a straight line. It runs from -1 to +1. At +1 they move up together on a perfect line. At 0 there is no straight-line relationship — a shapeless cloud. At -1 one goes up exactly as the other goes down. The sign is the direction; the size is the tightness. The goal here is to feel that, not just read the definition.

Drag the strength, flip the sign, watch r move

The points below are generated from a target correlation. Drag the slider to tighten or loosen the cloud, and use the toggle to flip the direction. The r computed from the points updates live — it tracks the slider, because that is exactly what r measures.

r computed from the points
+0.70
slider target r = +0.70
-1
0
+1
Read the tightness, not the steepness. Push the slider to the top: the points collapse onto a straight line and r sits near the sign you picked. Pull it to zero: the cloud spreads into a round blur and r sits near 0. What r measures is how tightly the points hug a line, not how steep the line is. A gentle line and a steep line can both have r near +1 as long as the points sit close to it. This panel uses standardized axes, so here the drawn line's slope happens to equal r — but read the cloud's tightness, not the line's tilt. In the real pairs below the slope and r are two different numbers, so the line there is not r.

Your read (optional)

Five real pairs, five values of r

Each tab is a real pair of columns — three from a ski resort, two from Summit Gear customers. The r is computed from the embedded sample, the same Pearson formula as above. Pick a tab and read the shape against the number.

r for this pair
The sign is the story, the size is the strength. A positive r means they rise together; a negative r means one rises as the other falls; an r near zero means knowing one tells you almost nothing about the other in a straight line. Correlation does not prove one causes the other — it only measures how they move. Note too that the fit line drawn on each scatter above has its own slope in the original units; that slope is not r, and r is the same single number whether the line is gentle or steep.

Never trust r without looking at the scatter

A single value of r can hide three different problems, which is why the scatter sits next to every number on this page:

  • Shape. r only scores a straight line. A strong curved or U-shaped pattern can return r near 0, and a few outliers can push r high when most of the points are unrelated. Two datasets with identical r can look nothing alike — the classic Anscombe example is four scatters with the same r and four completely different shapes.
  • Coincidence. Unrelated columns can line up by chance and post a high r that means nothing. Search hard enough across enough columns and a spurious match will turn up, so a number alone is never the evidence.
  • Sample size. These pairs have only about three dozen rows. At that size a small r is hard to tell apart from zero, so treat the weaker pairs as suggestive, not settled. Step 2, regression, brings the test that says whether a value is large enough to take seriously.

The rule for the whole week: read r and the scatter together, and never let r stand on its own.

Correlation, then regression, then logistic

This is step one of the week. Each next idea is built on this one.

Step 1 · you are here
Correlation
Do they move together? One number, r, from -1 to +1. Direction and tightness, nothing predicted yet.
Step 2
Regression (OLS)
Turn that into a line you can predict with. In a one-predictor fit the slope is r rescaled, and R-squared = r squared. Same relationship, now a forecast.
Step 3
Logistic
Not a mandatory next step — it is the fork you take when the outcome is yes/no rather than a number. When you are predicting whether the invoice goes bad instead of how many days it takes, you bend the regression line so it outputs a probability. Which tool you reach for depends on what you are predicting, not on a fixed order.
Why correlation is the root. Regression asks the same question as correlation and answers it with a line. Logistic asks it for a yes/no answer. Get r right — what its sign and size mean, and what it does not claim — and the next two steps are extensions of it, not new ideas.

The same r, in Excel

Everything on this page is one spreadsheet function. CORREL takes two columns and returns the same r between -1 and +1.

=CORREL(array1, array2)  →  r, a number from -1 to +1

The practice workbook below has the ski and Summit Gear columns in tabs. One =CORREL is filled in as a worked example; the rest are blank cells next to prompts, for you to write the function and watch it compute. Build a few correlations yourself, then come back and check them against the tabs above.

Download the practice workbook correlation_practice.xlsx Opens in Excel, Google Sheets, or LibreOffice.
Carry it to the tools. In Python the same number is df['a'].corr(df['b']) or numpy.corrcoef(a, b). In Excel it is =CORREL. Different spelling, identical r. Next stop is OLS, which turns this number into a prediction.