Math · 93 calculators
Coefficient Of Determination Calculator
The coefficient of determination answers a direct question: what share of the variation in your observed values is explained by your model's predictions? This page works through the ratio of residual variation to total variation, shows what values of one, zero and below zero mean, and explains the adjusted figure used when a single predictor is fitted to four observations.
Last updated
R-squared
0.85
- Residual sum of squares
- 3
- Total sum of squares
- 20
- Adjusted R-squared
- 0.775
Values update as you type. This calculator covers the single scenario its formula assumes — see Common Mistakes for what it leaves out.
The formula this calculator uses
R-squared = 1 - SSresidual / SStotal
- R-squared
- Coefficient of determination, the explained share of variance
- SSresidual
- Sum of squared gaps between observations and predictions
- SStotal
- Sum of squared gaps between observations and their mean
- n
- Number of observations
- k
- Number of predictors in the model
How to check the result by hand
- 1
Find the mean of the observed values
Add the observed values y1 to y4 and divide by four. For 3, 5, 7 and 9 the total is 24 and the mean is 6. This mean is the baseline that a model with no useful predictors would predict for every case, and it anchors the total sum of squares.
- 2
Compute the residual sum of squares
For each pair, subtract the prediction p from the observed value y, square the result, and add all four squared gaps. With predictions 4, 5, 6 and 8 the gaps are -1, 0, 1 and 1, whose squares add to 3. This is the variation the model leaves unexplained.
- 3
Compute the total sum of squares
For each observed value, subtract the mean found in step one, square the difference, and add all four results. Around a mean of 6 the gaps are -3, -1, 1 and 3, whose squares add to 20. This is the total variation present in the observed data before any model is applied.
- 4
Divide and subtract from one
Divide the residual sum of squares by the total sum of squares to get the unexplained fraction, then subtract it from one. Here 3 over 20 is 0.15, so R-squared is 1 - 0.15 = 0.85. If the residual sum ever exceeds the total sum, this step correctly produces a negative value.
- 5
Apply the adjustment if required
For one predictor over four observations multiply the unexplained fraction by (n - 1) / (n - k - 1), which is three over two. That gives 0.225, so the adjusted R-squared is 0.775. Report the plain value when describing fit in this sample, and the adjusted value when comparing models with different predictor counts.
Common Questions
How does the Coefficient Of Determination Calculator work?
Square the gap between each observed value and its prediction and add them to get the residual sum of squares. Square the gap between each observation and the mean and add those to get the total sum of squares. Divide the first by the second and subtract from one. With observations 3, 5, 7, 9 and predictions 4, 5, 6, 8, the residual sum is 3, the total sum is 20 and R-squared is 0.85.
What do I need to enter in the Coefficient Of Determination Calculator?
It takes 8 inputs: Observed value 1, Predicted value 1, Observed value 2, Predicted value 2, Observed value 3, Predicted value 3, Observed value 4, Predicted value 4. Fields that expect a unit say so next to the label.
Where does R-squared come from?
It comes from R-squared = 1 - SSresidual / SStotal — the core definition: one minus the fraction of total variation left unexplained by the model. It gives 1 for a perfect fit, 0 for predicting the mean, and a negative value for a model worse than the mean.
What is the most common mistake with the Coefficient Of Determination Calculator?
Forgetting to square the residuals. Adding raw observed-minus-predicted gaps lets positive and negative errors cancel. The residuals in the default case are -1, 0, 1 and 1, which sum to 1 rather than 3, and that wrong total would give a misleading R-squared. Always square before summing so every gap contributes positively.
For worked examples, common mistakes and the limits of this formula, read the full How To Calculate The Coefficient Of Determination page.
