What a correlation coefficient measures

A correlation coefficient is a number between −1 and 1 that tells you how strongly two sets of data move together. If one goes up when the other goes up, the correlation is positive. If one goes up when the other goes down, the correlation is negative. If they move independently, the correlation is close to zero.

The most common type is the Pearson correlation coefficient, written as r. It measures linear relationships — meaning the data points roughly follow a straight line when you plot them on a graph. A correlation of 1 means a perfect positive relationship. A correlation of −1 means a perfect negative relationship. A correlation of 0 means no linear relationship at all.

You use correlation coefficients to understand whether two variables are connected. For example, you might calculate the correlation between hours studied and test scores, or between temperature and ice cream sales. The result tells you the strength and direction of that relationship.

Key Takeaways

  • The Pearson correlation coefficient ranges from −1 to 1 and measures how closely two variables move together in a straight-line pattern.
  • Computing by hand requires finding the mean of each variable, calculating deviations, multiplying them, and dividing by the standard deviations of both variables.
  • A spreadsheet program like Excel or Google Sheets can calculate correlation in seconds using the CORREL or PEARSON function.
  • A correlation near 1 or −1 shows a strong relationship; a correlation near 0 shows little to no linear relationship.
  • Correlation does not prove that one variable causes the other — it only shows whether they move together.

The formula and what each part means

The Pearson correlation coefficient uses this formula:

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

Breaking this down: x and y are your two variables. (x-bar) is the average of all x values. ȳ (y-bar) is the average of all y values. The numerator — the top part — is the sum of the products of each deviation from the mean. The denominator — the bottom part — is the square root of the product of the sum of squared deviations for each variable. This denominator is actually the product of the standard deviations, which is why the formula sometimes appears written differently.

The formula works because it measures how much the two variables vary together (numerator) relative to how much they vary separately (denominator). When they move together consistently, the numerator is large. When they move independently, the numerator is small.

Computing correlation by hand: step-by-step

Suppose you have five data points: x values are 2, 4, 6, 8, 10 and y values are 3, 5, 7, 9, 11. Follow these steps.

Step 1: Find the mean of x and the mean of y. The mean of x is (2 + 4 + 6 + 8 + 10) ÷ 5 = 6. The mean of y is (3 + 5 + 7 + 9 + 11) ÷ 5 = 7.

Step 2: Subtract the mean from each value. For x: (2 − 6) = −4, (4 − 6) = −2, (6 − 6) = 0, (8 − 6) = 2, (10 − 6) = 4. For y: (3 − 7) = −4, (5 − 7) = −2, (7 − 7) = 0, (9 − 7) = 2, (11 − 7) = 4.

Step 3: Multiply each pair of deviations. (−4)(−4) = 16, (−2)(−2) = 4, (0)(0) = 0, (2)(2) = 4, (4)(4) = 16. Sum these: 16 + 4 + 0 + 4 + 16 = 40.

Step 4: Square each deviation and sum them separately. For x: (−4)² + (−2)² + 0² + 2² + 4² = 16 + 4 + 0 + 4 + 16 = 40. For y: (−4)² + (−2)² + 0² + 2² + 4² = 16 + 4 + 0 + 4 + 16 = 40.

Step 5: explore the formula. r = 40 / √(40 × 40) = 40 / √1600 = 40 / 40 = 1. This result of 1 means a perfect positive correlation — the two variables move together perfectly.

Using Excel or Google Sheets

A spreadsheet program does this calculation when ready. In Excel, use the CORREL function. Type =CORREL(A1:A5, B1:B5) where A1:A5 contains your x values and B1:B5 contains your y values. Press Enter and the correlation coefficient appears.

Google Sheets works the same way. You can also use the PEARSON function in either program — =PEARSON(A1:A5, B1:B5) — and get the same result. Both functions accept ranges of any size, so you can calculate correlation for hundreds of data points without doing arithmetic by hand.

If you are working with data already in a spreadsheet, this is the fastest and most accurate method. Spreadsheets also reduce the risk of arithmetic errors that can happen when calculating by hand.

Interpreting the result

A correlation coefficient of 0.9 or higher (or −0.9 or lower) usually indicates a strong relationship. A coefficient between 0.5 and 0.9 (or −0.5 and −0.9) suggests a moderate relationship. A coefficient between 0 and 0.5 (or 0 and −0.5) indicates a weak relationship. A coefficient very close to 0 means the two variables have little to no linear relationship.

The sign matters. A positive correlation means when one variable increases, the other tends to increase. A negative correlation means when one variable increases, the other tends to decrease. The magnitude — how far from zero — tells you the strength of that relationship.

Remember that correlation measures association, not causation. A high correlation between two variables does not mean one causes the other. Both might be influenced by a third variable, or the relationship might be coincidental. Always think about whether the relationship makes logical sense before drawing conclusions.

Common mistakes when calculating correlation

The most frequent error is arithmetic mistakes in the hand calculation, especially when squaring deviations or summing products. Using a spreadsheet eliminates this risk. Another mistake is confusing correlation with causation — a strong correlation does not prove one variable causes changes in the other.

A third mistake is using correlation when the relationship is not linear. If your data points form a curve rather than a line, the Pearson correlation coefficient may be misleading. In those cases, you might need a different measure, such as Spearman's rank correlation, which measures monotonic relationships instead.

Finally, some people calculate correlation on data that should not be correlated at all — for example, correlating unrelated categories or mixing variables with different units in ways that do not make sense. Always check that your two variables are actually comparable before you compute.

When to use correlation in real work

Correlation is useful when you want to understand whether two measurements move together. In business, you might correlate advertising spending with sales revenue. In health research, you might correlate exercise frequency with resting heart rate. In education, you might correlate study hours with exam scores.

Correlation is also a starting point for more advanced analysis. If two variables are strongly correlated, you might then build a regression model to predict one from the other. If they are uncorrelated, you know they are independent and do not need to model them together.

The key is to use correlation as a descriptive tool — to describe the relationship you observe in your data — not as proof of a causal mechanism. Correlation answers the question "Do these move together?" but not "Does one cause the other?"

Frequently Asked Questions

What is the difference between correlation and causation?

Correlation measures whether two variables move together. Causation means one variable directly causes changes in the other. A high correlation can exist without causation — both variables might be influenced by a third factor, or the relationship might be coincidental. You need additional evidence beyond correlation to establish that one variable causes another.

Can correlation be greater than 1 or less than −1?

No. The Pearson correlation coefficient always falls between −1 and 1. If your calculation produces a result outside this range, you made an arithmetic error. A result of exactly 1 or −1 indicates a perfect linear relationship, which is rare in real-world data.

What does a correlation of 0 mean?

A correlation of 0 means there is no linear relationship between the two variables. They do not move together in a straight-line pattern. However, they might still have a non-linear relationship — for example, a curved or U-shaped pattern — so a zero correlation does not mean the variables are completely unrelated.

Should I use Pearson correlation for all types of data?

Pearson correlation works best for continuous numerical data that have a roughly linear relationship. If your data are ranks or categories, use Spearman's rank correlation instead. If the relationship is clearly curved rather than straight, Pearson correlation may underestimate the strength of the relationship.

How many data points do I need to calculate a meaningful correlation?

Technically you need at least two points to calculate correlation, but the result is unreliable with so few. Most statisticians recommend at least 30 data points for a correlation to be meaningful. With fewer points, random variation can produce a high correlation even when no real relationship exists.