Library / Statistics / STA-08
Statistics
Coefficient of determination
Share of the variation in y that the fitted model explains.
- Ref
- STA-08
- Rev
- v1
- Field
- Statistics
- Result
- R2
SS_res = Σ(y − ŷ)² is the sum of squared residuals, the variation left over after the fit, and SS_tot = Σ(y − ȳ)² the total variation about the mean. R² runs from 0 (no better than the mean) to 1 (perfect fit). For a straight-line fit it equals the square of the correlation r.
Share of the variation in y that the fitted model explains. 1 is a perfect fit; 0 is no better than using the mean.
Calculator
- Variation explained by the model72
- Correlation size √R² (straight-line fit)0.8944
What drives the result
Each variable is moved across its typical range while the others stay at the values above. The longest bar is the key driver.
- R² = 0.8 means 80 % of the scatter in y is accounted for by the model.
- Adding more terms to a model never lowers R², so compare models with adjusted R², which penalises extra terms.
Chart data as tables
Ranked variables
| Variable | Typical range | Lowest result | Highest result | Swing () | Local step | Change in result |
|---|---|---|---|---|---|---|
| SStot Total sum of squares | 1 to 1,000 | −17 | 0.982 | 17.98 | +10% | +2.27 % |
| SSres Residual sum of squares | 0 to 1,000 | −10.11 | 1 | 11.11 | +10% | −2.5 % |
Sweep of Total sum of squares
| Total sum of squares | R² |
|---|---|
| 1 | −17 |
| 2.371 | −6.591 |
| 5.623 | −2.201 |
| 13.34 | −0.3498 |
| 31.62 | 0.4308 |
| 74.99 | 0.76 |
| 177.8 | 0.8988 |
| 421.7 | 0.9573 |
| 1,000 | 0.982 |
Sweep one variable
Variables and how each one contributes
R²
What the equation gives you. Everything else feeds it.
Residual sum of squares
The sum of squared differences between the data and the fitted model. Lowers R², since R² = 1 − SS_res/SS_tot: a 10 % rise in SS_res (to 19.8) takes R² from 0.80 to 0.78.
Total sum of squares
The total variation of y about its mean. Raises R² for a fixed residual, since the same leftover scatter is a smaller share of a larger total: a 10 % rise in SS_tot takes R² from 0.80 to 0.82.
Worked example with the values above
- Ratio of leftover to total variation: 18 / 90 = 0.2.
- Subtract from 1.
- R² = 0.8, so 80 % of the variation is explained.
Assumptions and limits
- The residuals are small, unbiased and roughly constant in size.
- The model includes an intercept (otherwise R² is defined differently).
Common mistakes
- Treating a high R² as proof the model form is correct.
- Comparing R² between models fitted to different data.
Statistics and uncertainty
R² is the share of variation explained by the model. A high R² does not guarantee a good model; check residuals, and use adjusted R² when comparing models with different numbers of terms.
Where it is used
- Judging how well a fitted model predicts measured performance.
- Comparing trial calibration curves.
Maths you need
- Residuals: data minus fitted value
- Sums of squares: Σ(y − ȳ)²