Your Equation

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

Solve for
01,000
11,000
  • 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² () current value 0.8
SStotTotal sum of squaresKey driver
−170.982
SSresResidual sum of squares
−10.11
  • 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

VariableTypical rangeLowest resultHighest resultSwing ()Local stepChange in result
SStot Total sum of squares1 to 1,000 −170.98217.98+10%+2.27 %
SSres Residual sum of squares0 to 1,000 −10.11111.11+10%−2.5 %

Sweep of Total sum of squares

Total sum of squaresR²
1−17
2.371−6.591
5.623−2.201
13.34−0.3498
31.620.4308
74.990.76
177.80.8988
421.70.9573
1,0000.982

Sweep one variable

R² ()Hover, touch, or use the arrow keys on the chart
−15−10−50 1520100500 Total sum of squares, log scale now 0.8

Variables and how each one contributes

R2

R²

Result ·

What the equation gives you. Everything else feeds it.

SSres

Residual sum of squares

· typical 0 to 1,000

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.

SStot

Total sum of squares

· typical 1 to 1,000

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

  1. Ratio of leftover to total variation: 18 / 90 = 0.2.
  2. Subtract from 1.
  3. 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 − ȳ)²

Related formulas

Practise this formula