Table of Contents
R-Squared is a statistical measure that indicates the level of variation in a dependent variable that is explained by an independent variable(s). It is commonly used to evaluate the performance of a regression model. The calculation of R-Squared involves several steps that can be performed manually by hand. First, the data points for the dependent and independent variables are plotted on a scatter plot. Then, the best-fit line is drawn through the data points. Next, the distance between each data point and the best-fit line is calculated. This distance is squared and added together to find the sum of squared errors (SSE). The total sum of squares (SST) is also calculated by finding the squared distance between each data point and the mean of the dependent variable. Finally, R-Squared is obtained by dividing the difference between SST and SSE by SST. This result is then subtracted from 1 to get the final R-Squared value. This process can be repeated for different regression models to compare their R-Squared values and determine the best fitting model.
Calculate R-Squared by Hand
In statistics, R-squared (R2) measures the proportion of the variance in the that can be explained by the predictor variable in a regression model.
We use the following formula to calculate R-squared:
R2 = [ (nΣxy – (Σx)(Σy)) / (√nΣx2-(Σx)2 * √nΣy2-(Σy)2) ]2
The following step-by-step example shows how to calculate R-squared by hand for a given regression model.
Step 1: Create a Dataset
First, let’s create a dataset:

Step 2: Calculate Necessary Metrics
Next, let’s calculate each metric that we need to use in the R2 formula:

Step 3: Calculate R-Squared
Lastly, we’ll plug in each metric into the formula for R2:
- R2 = [ (nΣxy – (Σx)(Σy)) / (√nΣx2-(Σx)2 * √nΣy2-(Σy)2) ]2
- R2 = [ (8*(2169) – (72)(223)) / (√8*(818)-(72)2 * √8*(6447)-(223)2) ]2
- R2 = 0.6686
Note: The n in the formula represents the number of observations in the dataset and turns out to be n = 8 observations in this example.
Assuming x is the predictor variable and y is the response variable in this regression model, the R-squared for the model is 0.6686.
This tells us that 66.86% of the variation in the variable y can be explained by variable x.
Cite this article
stats writer (2024). How can R-Squared be calculated by hand?. PSYCHOLOGICAL SCALES. Retrieved from https://scales.arabpsychology.com/stats/how-can-r-squared-be-calculated-by-hand/
stats writer. "How can R-Squared be calculated by hand?." PSYCHOLOGICAL SCALES, 2 May. 2024, https://scales.arabpsychology.com/stats/how-can-r-squared-be-calculated-by-hand/.
stats writer. "How can R-Squared be calculated by hand?." PSYCHOLOGICAL SCALES, 2024. https://scales.arabpsychology.com/stats/how-can-r-squared-be-calculated-by-hand/.
stats writer (2024) 'How can R-Squared be calculated by hand?', PSYCHOLOGICAL SCALES. Available at: https://scales.arabpsychology.com/stats/how-can-r-squared-be-calculated-by-hand/.
[1] stats writer, "How can R-Squared be calculated by hand?," PSYCHOLOGICAL SCALES, vol. X, no. Y, ص Z-Z, May, 2024.
stats writer. How can R-Squared be calculated by hand?. PSYCHOLOGICAL SCALES. 2024;vol(issue):pages.
