Pearson correlation coefficient

Topic
Data analysis and statistics
Contents

The Pearson correlation coefficient (r) measures how closely two numeric variables move together along a straight line. It runs from −1 to +1: +1 is a perfect positive linear relationship, −1 a perfect negative one, and 0 means no linear relationship. In surveys it shows, for example, whether people who rate support higher also tend to give a higher likelihood to recommend.

How to read the number behind a test result: p-value.

This page is about the coefficient itself: the formula, how to read r and where it misleads. For the wider method, with other coefficients and correlation matrices, see correlation analysis.

The formula

r = Σ(x − x̄)(y − ȳ) ÷ √[Σ(x − x̄)² × Σ(y − ȳ)²]

  • x, y: the two answers of each respondent, one pair per person.
  • x̄, ȳ: the mean of each variable.
  • The top of the fraction adds up how each pair moves together around the means. The bottom scales the sum so that r always lands between −1 and +1.

Put another way, r is the covariance of x and y divided by the product of their standard deviations. Because of this scaling r has no units: it stays the same if you turn a 1–5 scale into 0–100.

Worked example

Six customers answered two questions on a 0–10 scale: "How satisfied are you with the speed of support?" (x) and "How likely are you to recommend us?" (y). Both means are 6.

Customerxyx − x̄y − ȳ(x − x̄)(y − ȳ)
123−4−312
245−2−12
354−1−22
478122
587212
61094312

The products add up to 32. Σ(x − x̄)² = 42 and Σ(y − ȳ)² = 28, so r = 32 ÷ √(42 × 28) = 32 ÷ 34.29 ≈ 0.93, a strong positive relationship. Six answers are enough to show the arithmetic but not to draw conclusions: with so few points, one unusual customer can move r a lot. The Pearson correlation calculator does the same for two pasted columns of any length and adds r² and the p-value.

How to read r

The sign gives the direction: positive means y tends to rise with x, negative means it tends to fall. The absolute value gives the strength. The most widely used benchmarks come from Jacob Cohen (1988):

|r|Strength
below 0.1Negligible
0.1 to 0.3Small (weak)
0.3 to 0.5Medium (moderate)
0.5 and aboveLarge (strong)

Cohen offered these as a fallback for fields without norms of their own. In some research r = 0.3 is a useful finding, in other work r = 0.7 is a disappointment.

r² (r squared) is the share of the variation in one variable that goes along with the other. r = 0.5 gives r² = 0.25: a quarter of the variation is shared, not half.

Is the correlation significant?

To check whether r could be a fluke of sampling, test it against r = 0 with t = r × √(n − 2) ÷ √(1 − r²) and n − 2 degrees of freedom, where n is the number of respondents.

  • r = 0.20 with 30 respondents: t ≈ 1.08, p ≈ 0.29, not significant.
  • The same r = 0.20 with 100 respondents: t ≈ 2.02, p ≈ 0.046, significant at the 0.05 level.
  • r = 0.10 with 1,000 respondents: p ≈ 0.002, significant, yet r² is only 1%.

A significant r is one that is unlikely to be zero in the population, not necessarily a strong one. Read the p-value together with the size of r, as explained in statistical significance.

What r does not tell you

  • Cause and effect. r = 0.6 between the support rating and the likelihood to recommend does not show that better support raises loyalty. Both may follow from a third factor, such as how long someone has been a customer.
  • Curved relationships. r close to 0 means no straight-line relationship, not no relationship at all. A U-shape, with satisfaction lowest in the middle of the price range, can give r near zero.
  • The slope. r does not say by how many points y rises for each point of x. That is what regression analysis estimates.
  • A percentage. r = 0.6 does not mean "60% related". The shared variation is r² = 36%.

Look at a scatter plot before you trust r. Anscombe's quartet (1973) is a set of four small datasets with the same r of about 0.82 and completely different shapes: a line, a curve, a perfect line bent by one outlier, and a single extreme point that creates the whole correlation.

Pearson or Spearman for survey data

PearsonSpearman
Works withThe valuesThe ranks of the values
DetectsStraight-line relationshipsAny relationship that keeps rising or keeps falling
OutliersSensitiveMuch less sensitive
Typical survey data0–10 ratings, sums of several Likert items, age, spendSingle Likert items, rankings, skewed data

A single 5-point agree–disagree item is ordinal (see levels of measurement), so Spearman is the safer choice for it. The Spearman correlation calculator works the same way as the Pearson one. If both coefficients come out close, the choice does not change the conclusion.

Common mistakes

  • Correlating everything with everything. Fifteen questions make 105 pairs, and some of them will look strong by chance. Choose the pairs from hypotheses you wrote down before looking.
  • Mixing groups. Two segments with different average levels can produce a correlation that exists in neither segment on its own. Check r within each key segment.
  • Restricted range. If almost everyone answered 9 or 10, r comes out lower than the real relationship, because there is too little variation to show it.
  • Treating codes as numbers. Region 1, 2 and 3 are labels, not quantities, and Pearson's r on them means nothing. The exception is a two-category variable coded 0 and 1, where r becomes the point-biserial correlation.

To get the two columns, export the survey answers to a spreadsheet: one row per respondent, one column per question. For a longer guide with survey examples, read Correlation in surveys: what r can and cannot tell you.

0