R-Squared Calculator

How Much of the Variance Does the Model Actually Explain?

Every regression model makes predictions that miss the mark to some degree. R², the coefficient of determination, quantifies exactly how much of the spread in the observed data is accounted for by the model versus how much remains unexplained. A value close to 1 means the model tracks the data closely; a value near 0 means the model explains almost nothing beyond the average.

The Formula

This calculator supports two calculation modes, both taken directly from the underlying formulas:

From correlation coefficient:
R² = r²

From actual vs. predicted data:
R² = 1 − (SSres / SStot)
SSres = Σ(actual − predicted)²
SStot = Σ(actual − mean)²

Worked Example

Take actual values 3, 5, 7, 9 against predicted values 2.8, 5.1, 6.9, 9.2:

R² from actual vs. predicted data
QuantityValue
SSres (residual sum of squares)0.10
SStot (total sum of squares)20.00
0.995

Computed directly from the calculator's formula.

An R² of 0.995 means the model explains 99.5% of the variance in the actual values — the predictions here are extremely close to the observed outcomes.

Interpreting the Number

R² is unitless and ranges from 0 to 1 for models fit by ordinary least squares (it can technically go negative for poorly specified models evaluated out-of-sample). What counts as a "good" R² depends heavily on the field: physical science models routinely hit 0.95+, while models of human behavior — spending habits, survey responses, social outcomes — often top out around 0.3–0.5 because so much of the variance is driven by factors outside the model.

Where This Calculation Matters

  • Model comparison — when choosing between competing regression specifications, R² is a first-pass check on explanatory power (though it should never be the only criterion, since it always increases as predictors are added).
  • Reporting results — R² is a standard line item in regression output tables across economics, biology, and engineering.
  • Quick conversion — if you already have a correlation coefficient r from a bivariate analysis, squaring it gives R² instantly without recomputing from raw data.

How to Use This Calculator

  1. Choose a calculation mode: From Correlation Coefficient (r) or From Actual vs Predicted Data.
  2. For the correlation mode, enter r (a single value between −1 and 1).
  3. For the data mode, enter comma-separated actual values and the corresponding comma-separated predicted values.
  4. Select Calculate to see R² and the percentage of variance explained.

Related Calculations

For a version that penalizes R² for adding unnecessary predictors, use the Adjusted R-Squared Calculator. To compute the underlying regression line first, see the Linear Regression Calculator.