Correlation Coefficient: Formula, Example and How to Read Scatter Plots
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.
- 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 and .
r = Sxy ÷ √(Sxx × Syy)
| Symbol | Meaning | How to find it |
|---|---|---|
| Sxy | Sum of the products of the deviations of x and y | Add up (x − ) × (y − ) for all pairs |
| Sxx | Sum of the squared deviations of x | Add up (x − )2 for all values |
| Syy | Sum of the squared deviations of y | Add up (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 = 120 and = 54.
| Temperature x (°C) | Hardness y | x − | y − | (x − )(y − ) | (x − )2 | (y − )2 |
|---|---|---|---|---|---|---|
| 100 | 52 | −20 | −2 | 40 | 400 | 4 |
| 110 | 54 | −10 | 0 | 0 | 100 | 0 |
| 120 | 55 | 0 | 1 | 0 | 0 | 1 |
| 130 | 54 | 10 | 0 | 0 | 100 | 0 |
| 140 | 55 | 20 | 1 | 20 | 400 | 1 |
| Total | Sxy = 60 | Sxx = 1,000 | Syy = 6 |
r = 60 ÷ √(1,000 × 6) = 60 ÷ √6,000 = 60 ÷ 77.46 = 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 r | Guideline |
|---|---|
| 0.7 or more | A strong correlation exists |
| 0.4 to less than 0.7 | A moderate correlation exists |
| 0.2 to less than 0.4 | A weak correlation exists |
| Less than 0.2 | Almost no correlation |
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.
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 pairs | Guideline for the absolute value of r |
|---|---|
| 5 | 0.878 or more |
| 10 | 0.632 or more |
| 20 | 0.444 or more |
| 30 | 0.361 or more |
| 50 | 0.279 or more |
| 100 | 0.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 calculate | Example 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.