🧮R-Squared Calculator

Calculate the R-squared coefficient of determination for a regression model from actual and predicted values

How to Use the R-Squared Calculator

This calculator takes actual and predicted value data and instantly computes R-squared, the coefficient of determination that shows how well a regression model explains the data. R-squared is calculated as 1-(residual sum of squares ÷ total sum of squares), where the residual sum of squares (SS_res) is the sum of squared differences between actual and predicted values, and the total sum of squares (SS_tot) is the sum of squared differences between the actual values and their mean.

R-squared typically ranges from 0 to 1, and the closer to 1, the better the model explains the variation in the actual values. For example, R²=0.8 means the model explains about 80% of the variation in the data. However, if the predictions perform worse than simply guessing the mean every time, R-squared can turn negative.

The actual and predicted value sets must have the same number of entries, with at least 2 each — and if all actual values are identical (making the total sum of squares 0), R-squared is undefined and the calculator immediately shows a guidance message.

Frequently Asked Questions

How do I interpret the R-squared value?

R-squared typically ranges from 0 to 1 (though it can go negative), and the closer to 1, the better the regression model explains the variation in the actual values. For example, R²=0.8 means the model explains about 80% of the variation.

Can R-squared be negative?

Yes. If the predictions are worse than simply predicting the mean every time, R-squared can be negative, meaning the model performs worse than a naive average-based guess.