Correlation Coefficient: Formula, Example and How to Read Scatter Plots

Published:

Open the Correlation Analysis Tool (opens in a new tab)

What is the correlation coefficient?

The correlation coefficient is a number that shows how strong a linear relationship exists between two items. It is used when examining the relationship between two measured items, such as “heating temperature” and “hardness,” or “part thickness” and “weight.”

The correlation coefficient is denoted by r and takes values from −1 to 1.

  • Positive correlation (r greater than 0): the larger one is, the larger the other is
  • Negative correlation (r less than 0): the larger one is, the smaller the other is
  • No correlation (r close to 0): no linear relationship is seen

The closer r is to 1 or −1, the stronger the relationship.

Scatter plots and the correlation coefficient

The correlation coefficient is basically viewed together with a scatter plot (a chart with the two items on the horizontal and vertical axes and points plotted). The arrangement of the points and the correlation coefficient correspond as follows.

x y
Positive correlation (r = 0.85)
x y
Negative correlation (r = −0.85)
x y
No correlation (r = 0.00)
  • The more narrowly the points gather around a rising straight line, the closer r gets to 1
  • For a falling line, r is negative
  • When the points are scattered roundly and no slope can be seen, r is close to 0

Formula

Let the two items be x and y, and their means be x and y.

r = Sxy ÷ √(Sxx × Syy)

SymbolMeaningHow to find it
SxySum of the products of the deviations of x and yAdd up (x − x) × (y − y) for all pairs
SxxSum of the squared deviations of xAdd up (x − x)2 for all values
SyySum of the squared deviations of yAdd up (y − y)2 for all values

A deviation is the difference between each value and the mean. The more pairs in which x and y deviate in the same direction, the larger Sxy becomes, and the larger r becomes.

Worked example

These are the results of measuring heating temperature x and hardness y 5 times. The means are x = 120 and y = 54.

Temperature x (°C)Hardness yx − xy − y(x − x)(y − y)(x − x)2(y − y)2
10052−20−2404004
11054−10001000
1205501001
1305410001000
14055201204001
TotalSxy = 60Sxx = 1,000Syy = 6

r = 60 ÷ √(1,000 × 6) = 60 ÷ √6,000 = 60 ÷ 77.46 = 0.77

100 120 140 52 54 56 Temperature (°C) Hardness
Scatter plot of heating temperature and hardness (r = 0.77)

Hardness tends to increase as temperature rises, which can be called a relatively strong positive correlation.

Guidelines for the strength of correlation

The guidelines commonly used are as follows.

Absolute value of rGuideline
0.7 or moreA strong correlation exists
0.4 to less than 0.7A moderate correlation exists
0.2 to less than 0.4A weak correlation exists
Less than 0.2Almost no correlation
x y
Strong correlation: 0.7 or more (this chart: r = 0.85)
x y
Moderate correlation: 0.4 to less than 0.7 (this chart: r = 0.55)
x y
Weak correlation: 0.2 to less than 0.4 (this chart: r = 0.30)
x y
Almost no correlation: less than 0.2 (this chart: r = 0.05)

However, the meaning of these guidelines changes with the number of data points. Please also check the “Points to note” below.

Points to note when reading the correlation coefficient

The correlation coefficient is convenient because it summarizes the relationship in a single number, but looking at the number alone can lead to wrong judgments. Always check it together with a scatter plot.

x y
Panel 1: An outlier is present (r = 0.05 without the outlier, r = 0.65 with it)
x y
Panel 2: A curved relationship (r = 0.00)
x y Group 1 Group 2
Panel 3: Groups are mixed (r = 0.80 overall)

A correlation does not always mean cause and effect

Even when the correlation coefficient is large, one variable is not necessarily the cause of the other. For example, when the temperature rises in summer, both “ice cream sales” and “air conditioner failures” increase, so the two show a correlation, but ice cream does not break air conditioners. In this way, there are apparent correlations produced by another factor. To confirm a cause, combine knowledge of the process and experiments in your judgment.

One outlier can change the value greatly

Just one point far from the others can change the correlation coefficient greatly (panel 1). If you find an outlier on the scatter plot, check whether it is a measurement mistake or a recording error.

It cannot express curved relationships

The correlation coefficient expresses only the strength of a linear relationship. Even when there is a curved relationship, such as a hill shape or a U shape, the correlation coefficient can be close to 0 (panel 2).

Are groups with different characteristics mixed together?

When data from groups with different characteristics, such as equipment, material lots, or operators, are mixed, there may appear to be a correlation overall even though there is no relationship within each group (panel 3). Conversely, a relationship may also be hidden. If you split the data into groups and look at them (stratify them), the true relationship becomes visible.

With few data points, a large value can occur by chance

With few data points, a large correlation coefficient can occur by chance even when there is actually no relationship. The guideline values of the absolute value of r above which chance is unlikely (a correlation can be said to exist at the 5% significance level) are as follows.

Number of data pairsGuideline for the absolute value of r
50.878 or more
100.632 or more
200.444 or more
300.361 or more
500.279 or more
1000.197 or more

The worked example above (r = 0.77 with 5 pairs) does not reach this guideline, so the possibility of chance cannot be ruled out. To confirm the relationship, collect more data and investigate again.

Coefficient of determination r2

The square of the correlation coefficient, r2, is called the coefficient of determination. It shows the proportion of the variation in y that can be explained by its linear relationship with x.

In the worked example, r2 = 0.772 ≈ 0.60 (more precisely, 3,600 ÷ 6,000 = 0.60), which means that about 60% of the variation in hardness can be explained by its linear relationship with temperature.

Calculating in Excel

This is an example where x is in A2 to A21 and y is in B2 to B21.

What to calculateExample formula
Correlation coefficient r=CORREL(A2:A21,B2:B21)
Coefficient of determination r2=RSQ(B2:B21,A2:A21)

A scatter plot can be made by selecting the two columns and choosing Insert › Insert Scatter (X, Y) or Bubble Chart › Scatter.

Calculating with the tool on this site

With the Correlation Analysis Tool, just paste in the data for two items and it calculates the correlation coefficient and the coefficient of determination (shown as R² in the tool) and displays a scatter plot. A regression line can also be displayed. No registration is required, and it is free to use.

Open the Correlation Analysis Tool (opens in a new tab)

All guides