The coefficient of determination
Measure how much a least squares line really explains with the coefficient of determination in Year 12 VCE General Mathematics. A Wimmera wheat farmer knows rainfall matters, but how much of the ups and downs in yield does it account for? Squaring Pearson's correlation coefficient gives \(r^2\), a share of the variation from \(0\) to \(1\).
You will square \(r\) (from summary values or technology), turn \(r^2\) into a percentage and write the standard sentence with the response variable first. You will also work back from \(r^2\) to \(r\) using the direction of the association, compare two possible explanatory variables, and then use residuals to check whether a straight line fits at all.
Theory
The coefficient of determination, \(r^2\), tells you how much of the variation in a response variable a least squares line accounts for. This Year 12 General Mathematics guide for students in Victoria shows how to calculate \(r^2\), write the standard explained-variation sentence, and work back from \(r^2\) to \(r\).
The coefficient of determination, \(r^2\), measures how much of the variation in the response variable can be explained by the variation in the explanatory variable, using the least squares line. It is a number from \(0\) to \(1\), usually quoted as a percentage.
It is the square of Pearson's correlation coefficient: \(r^2 = (r)^2\). Going back, \(r = \pm\sqrt{r^2}\), with the sign taken from the direction of the association (or the sign of the slope). Squaring removes the sign, so \(r^2\) says nothing about direction, and it is the same whichever variable is called \(x\).
Whatever is not explained, \(1 - r^2\), is due to other factors. The standard way to report \(r^2\) is: “[percentage] of the variation in [response] can be explained by the variation in [explanatory].”
From \(r\) to the coefficient of determination:
From \(r^2\) back to \(r\), choosing the sign from the direction of the association:
Explained and unexplained variation, as percentages:
Using the coefficient of determination
- Get \(r\). Use the value given, or find it with technology, keeping the unrounded value.
- Square it. \(r^2 = r \times r\). A negative \(r\) gives a positive \(r^2\).
- Convert to a percentage. Multiply by \(100\%\), rounding only at the end.
- Write the sentence. "\(X\%\) of the variation in [response] can be explained by the variation in [explanatory]." The rest, \(100\% - X\%\), is due to other factors.
- Going backwards. From \(r^2\), take \(\sqrt{r^2}\) and attach the sign from the direction (or the slope of the line), then judge the strength.
Square \(r\), then multiply by \(100\%\).
| \(r^2\) | \(=\) | \((0.94)^2\) |
| \(r^2\) | \(=\) | \(0.94 \times 0.94\) |
| \(r^2\) | \(=\) | \(0.8836\) |
| \(\text{explained}\) | \(=\) | \(0.8836 \times 100\%\) |
| \(\text{explained}\) | \(\approx\) | \(88\%\) |
| \(\text{not explained}\) | \(\approx\) | \(100\% - 88\%\) |
| \(\text{not explained}\) | \(\approx\) | \(12\%\) |
\(r^2 = 0.8836\). About 88% of the variation in annual heating cost can be explained by the variation in floor area. The other \(12\%\) is due to other factors, such as insulation or the type of heater.
Take the square root; the association is negative, so \(r\) is negative.
| \(|r|\) | \(=\) | \(\sqrt{0.4225}\) |
| \(|r|\) | \(=\) | \(0.65\) |
| \(r\) | \(=\) | \(-0.65\) |
\(r = -0.65\). Since \(0.5 \le 0.65 < 0.75\), this is a moderate negative linear association. About \(42\%\) of the variation in rainfall can be explained by the variation in distance from the coast.
| Growing-season rainfall (mm) | 300 | 350 | 400 | 450 | 500 | 550 |
|---|---|---|---|---|---|---|
| Wheat yield (t/ha) | 1.3 | 1.8 | 1.6 | 2.4 | 2.2 | 2.9 |
Enter rainfall as \(x\) and yield as \(y\). Square the unrounded \(r\):
| \(S_{xx}\) | \(=\) | \(43750\) |
| \(S_{yy}\) | \(\approx\) | \(1.6933\) |
| \(S_{xy}\) | \(=\) | \(250\) |
| \(r\) | \(=\) | \(\dfrac{S_{xy}}{\sqrt{S_{xx} \times S_{yy}}}\) |
| \(r\) | \(=\) | \(\dfrac{250}{\sqrt{43750 \times 1.6933}}\) |
| \(r\) | \(\approx\) | \(0.9185\) |
| \(r^2\) | \(\approx\) | \((0.9185)^2\) |
| \(r^2\) | \(\approx\) | \(0.8436\) |
| \(\text{explained}\) | \(\approx\) | \(84\%\) |
\(r \approx 0.92\) and \(r^2 \approx 0.84\). About 84% of the variation in wheat yield can be explained by the variation in growing-season rainfall. (Squaring the rounded \(r = 0.92\) gives \(0.8464\), or \(85\%\): always square the unrounded value.)
Compare explained variation by squaring each \(r\). The sign does not affect \(r^2\).
| \(r^2_{\text{training}}\) | \(=\) | \((-0.84)^2\) |
| \(r^2_{\text{training}}\) | \(=\) | \(0.7056\) |
| \(r^2_{\text{age}}\) | \(=\) | \((0.35)^2\) |
| \(r^2_{\text{age}}\) | \(=\) | \(0.1225\) |
About 71% of the variation in finishing time can be explained by the variation in weekly training distance, not \(84\%\): Jordan used \(r\) instead of \(r^2\). Only about \(12\%\) can be explained by the variation in age, so training distance explains far more. Its negative \(r\) just means runners who train further tend to finish faster.
Common pitfalls
Frequently asked questions
What is the coefficient of determination?
It is r squared, the square of Pearson's correlation coefficient. It gives the proportion of the variation in the response variable that can be explained by the variation in the explanatory variable.
How do you interpret r squared?
Write it as a percentage in the sentence: X% of the variation in the response can be explained by the variation in the explanatory variable. The rest is due to other factors.
How do you find r from r squared?
Take the square root of r squared, then make r negative if the association is negative (or the slope is negative) and positive if it is positive.
Can r squared be negative?
No. It is a square, so it is always between 0 and 1. A negative association still gives a positive r squared.
Does r squared change if you swap x and y?
No. r is the same whichever variable is x, so r squared is the same too. The explained-variation sentence should still name the response variable first.
Is a high r squared enough to say a linear model is good?
Not on its own. Check the residual plot as well: a clear pattern means the relationship is not linear even if r squared is high.