# R-Squared Calculator

> Get R² and adjusted R² for a straight-line fit with its F test, or for any model’s predictions against actual values, with SSres and SStot shown.

Category: Statistics & probability · Applies to: Worldwide · Last updated: 2026-10-29
Interactive calculator: https://calculators.geekmidst.com/calculators/regression-r-squared-calculator

R² is the share of the variation in y that a model explains: 1 − SSres ÷ SStot. Fit a line to x and y, or paste a model’s predictions next to the actual values.

Also called: Coefficient of determination calculator, R² calculator.

## Inputs
- Data (options: Fit a line to x, y, Actual vs predicted; default fit)
- X values (default 1, 2, 3, 4, 5)
- Y values (same order) (default 2, 4, 5, 4, 5)
- Actual values (default 3, 5, 7, 9)
- Predicted values (same order) (default 2.5, 5.5, 7, 8)
- Number of predictors in the model (k) (default 1)

## Results
- R²
- Adjusted R²
- Residual sum of squares (SSres)
- Total sum of squares (SStot)
- F statistic
- p-value of the F test
- Fitted line
- Observations (n)

## Formula

```
R² = 1 − SSres ÷ SStot;  adjusted R² = 1 − (1 − R²)(n − 1) ÷ (n − k − 1);  F = (SStot − SSres) ÷ (SSres ÷ (n − 2)) on 1 and n − 2 df
```

Where:
- SSres: Σ(actual − fitted)²
- SStot: Σ(actual − mean)²
- n: observations
- k: number of predictors (1 for a straight line)

## Worked example
1. The least-squares line is ŷ = 2.2 + 0.6x, leaving SSres = 2.4; SStot = Σ(y − 4)² = 6.
2. R² = 1 − 2.4 ÷ 6 = 0.6.
3. Adjusted R² = 1 − 0.4 × 4 ÷ 3 = 0.4667; F = 3.6 ÷ 0.8 = 4.5 on 1 and 3 df (p = 0.124).

**Result:** The straight line explains 60% of the variation in y (adjusted R² 0.47), but the F test is not significant with only five points.

## What the result means

R² says how much of the spread the model accounts for, not whether the model is right: a curved relation can have a high R² for a straight line and still be badly specified. Adjusted R² penalises extra predictors. With predictions from another model, a negative R² means the model is worse than predicting the mean every time.

## Assumptions and limits
- Fit mode uses ordinary least squares with an intercept; the F test assumes independent, normal, constant-variance residuals.
- Predictions mode uses R² = 1 − SSres ÷ SStot for any model, so it can be negative.
- The F test is not computed for supplied predictions, because their degrees of freedom depend on how the model was fitted.
- R² on the data used to fit a model overstates how well it predicts new data.

## Questions

### Is R² the same as r squared?

For a straight line fitted by least squares with an intercept, yes: R² equals the square of Pearson’s r. For other models it is not.

### What is a good R²?

It depends on the field. Physical measurements often exceed 0.95, while models of human behaviour may be useful at 0.2.

## Related calculators
- [Linear Regression Slope Calculator](https://calculators.geekmidst.com/calculators/linear-regression-slope-calculator)
- [Pearson Correlation Calculator](https://calculators.geekmidst.com/calculators/pearson-correlation-calculator)
- [RMSE Calculator](https://calculators.geekmidst.com/calculators/root-mean-square-error-calculator)
- [Mean Absolute Error Calculator](https://calculators.geekmidst.com/calculators/mean-absolute-error-calculator)

Source: GM¹X CalcVerse — https://calculators.geekmidst.com/calculators/regression-r-squared-calculator
