Skip to main content
Calkulon
Back to Guides
3 min read6 Steps

How to Calculate R-Squared: Step-by-Step Guide

Learn to calculate R-squared manually

Skip the math — use the calculator

Step-by-Step Instructions

1

Calculate the Mean of the Dependent Variable

First, calculate the mean of the dependent variable (y). This is done by summing all the y values and dividing by the number of observations (n). The formula for the mean is: ȳ = (Σy) / n

2

Calculate the Total Sum of Squares (SST)

Next, calculate the total sum of squares (SST). This is done by finding the difference of each y value from the mean, squaring it, and summing all these squared differences. The formula for SST is: SST = Σ(y - ȳ)²

3

Calculate the Sum of the Squared Errors (SSE)

Then, calculate the sum of the squared errors (SSE). This involves finding the difference between each observed y value and the predicted y value (based on the regression line), squaring it, and summing all these squared differences. The formula for SSE is: SSE = Σ(y - ŷ)², where ŷ is the predicted y value.

4

Apply the R-Squared Formula

Now, plug the values of SSE and SST into the R-squared formula: R² = 1 - (SSE / SST). This will give you the coefficient of determination.

5

Interpret the R-Squared Value

Finally, interpret the R-squared value. R² ranges from 0 to 1, where 0 indicates no correlation and 1 indicates perfect correlation. The closer R² is to 1, the better the model fits the data.

6

Worked Example and Common Mistakes

For example, suppose we have the following data: (1,2), (2,3), (3,5), (4,7), (5,8). First, calculate the mean of y: ȳ = (2 + 3 + 5 + 7 + 8) / 5 = 5. Then, calculate SST and SSE using the given data and a regression line. Finally, apply the R-squared formula. Common mistakes to avoid include incorrect calculation of the mean, SSE, or SST, and not using the correct formula for R-squared. For convenience, an R-squared calculator can be used, especially with large datasets.

Introduction to R-Squared Calculation

The coefficient of determination, R², is a statistical measure that represents the proportion of the variance in the dependent variable that is predictable from the independent variable. It provides an indication of the goodness of fit of the model.

Formula and Variables

The formula for R-squared is: R² = 1 - (SSE / SST) where:

  • R² = coefficient of determination
  • SSE = sum of the squared errors (residuals)
  • SST = total sum of squares

Diagram

Imagine a scatter plot with data points representing the relationship between the independent variable (x) and the dependent variable (y). The R-squared value measures how well a regression line fits the data.

Step-by-Step Calculation

To calculate R-squared manually, follow these steps:

Ready to Calculate?

Skip the manual work and get instant results.

Open Calculator

Settings

PrivacyTermsAbout© 2026 Calkulon