Home / 🔍 Inference Regression & Statistical Tests/ Residual Calculator
Please enter an equal number of valid numbers for both datasets.
Sum of Squared Residuals (SSR)
Sum of Residuals
Individual Residuals (e = Y - Ŷ)
#Actual (Y)Predicted (Ŷ)Residual (e)

When you build a linear regression trendline to forecast future data, you must mathematically verify how accurate that line actually is. Because no trendline is absolutely perfect, individual data points will always float slightly above or below your line. In statistics, the exact vertical distance between your raw data point and your predicted trendline is called a Residual (or Error).

Our free online Residual Calculator instantly measures the exact accuracy of your model. By evaluating the difference between your real-world observations and your mathematical predictions, you can determine if your line of best fit is mathematically sound, or if your model is fundamentally broken.


Understanding the Residual Formula

Calculating a residual is incredibly simple algebra. You are merely subtracting the Predicted Value (which you get from your regression equation) from the Observed Value (which is your raw data point). The formula is: e = y – ŷ.

Equation Variable Statistical Definition What it Actually Is
The y Variable The Observed Value The physical, real-world data point you collected during your experiment or survey.
The Variable (y-hat) The Predicted Value The mathematical guess. It is the exact point that sits directly on your line of best fit.
The e Variable The Residual (Error) The final calculated output. The absolute vertical distance between reality and your mathematical prediction.

How to Visually Interpret a Residual

Because the formula is strict subtraction (Observed minus Predicted), the calculator will generate both positive and negative numbers. This tells you exactly where your raw data sits on the graph relative to your trendline.

Calculated Residual Mathematical State Visual Meaning on the Graph
Positive Number (e.g., +4.2) Observed > Predicted The real-world data point floats above your regression line. Your model under-predicted the outcome.
Negative Number (e.g., -2.8) Observed < Predicted The real-world data point sinks below your regression line. Your model over-predicted the outcome.
Exactly Zero Observed = Predicted The real-world data point sits exactly on the line of best fit. Your model was completely perfect.

If you need to generate the baseline predicted values (ŷ) for your data, use our Linear Regression Calculator. To determine the overall percentage accuracy of your entire model based on these residuals, use our Coefficient of Determination Calculator (R-Squared).


Frequently Asked Questions (FAQ)

What is a Residual Plot?

A residual plot is a specialized graph where analysts plot the independent variable (X) on the horizontal axis and the calculated residuals on the vertical axis. If the dots on a residual plot look like a completely random cloud of static, your linear regression model is highly accurate. If the dots form a distinct pattern (like a curve or a megaphone shape), it proves your linear model is broken and you must upgrade to Polynomial Regression.

What does it mean if the sum of all my residuals is zero?

Nothing. In fact, if you calculate a line of best fit using the standard Ordinary Least Squares (OLS) method, the sum of all your positive and negative residuals will always equal exactly zero. This is a mathematical guarantee of the OLS algorithm; the positive errors directly cancel out the negative errors.

Why do statisticians square residuals?

Because the sum of all raw residuals always equals zero, statisticians cannot use that number to judge the overall accuracy of the model. By squaring every individual residual, all the negative numbers are converted into positive numbers. The calculator can then sum up all these squared values (creating the “Sum of Squared Residuals”) to measure the true, absolute error of the entire trendline.