Calculate R-squared by Hand
Calculating R-squared by hand is a fundamental skill in data analysis and statistics. It helps you understand the strength of the relationship between two variables and the goodness of fit of your data to a regression line.
- Enter the X and Y values, separated by commas.
- Enter the number of data points (N).
- Click ‘Calculate’.
The formula for calculating R-squared (coefficient of determination) is:
R² = 1 – (∑(yi – ŷi)² / ∑(yi – ȳ)²)
Where:
- yi = actual value
- ŷi = predicted value
- ȳ = mean of actual values
| X | Y |
|---|---|
| 1 | 2 |
| 2 | 4 |
| 3 | 6 |
| Sum of Squares | Degrees of Freedom | Mean Square |
|---|---|---|
| SSM | 2 | R² |
| SSE | 1 | 1 – R² |
| SST | 2 | Total |
- Always check the assumptions of your data before calculating R-squared.
- R-squared is not the only measure of model fit. Consider other metrics like adjusted R-squared and root mean squared error.
What does R-squared represent?
R-squared represents the proportion of the variance in the dependent variable that is predictable from the independent variable(s).