Calculate residuals without reversing the sign

To calculate residuals, subtract the predicted response from the observed response at the same input: e = y − ŷ. A positive residual means the model predicted too little; a negative residual means it predicted too much. Work through an original table and diagram, then use a reconstruction check to catch reversed signs before interpreting the result.

An adult architecture student compares a vertical blue cord with an upright translucent drawing panel in a white studio

Calculate residuals by separating input, observation and prediction

Start by identifying three quantities. The input x locates a case along the horizontal axis. The observed response y is the value listed for that case. The predicted response ŷ is what the supplied model gives when you substitute that same x. The small hat distinguishes a model output from an observation. Do not treat it as a second input or an exponent.

Our convention is e = y − ŷ, often called a raw residual. Keeping the order explicit matters because reversing subtraction changes every sign. Some applications define other error measures or standardize residuals, so read the stated definition before using a software column. This guide concerns the ordinary unscaled difference in the response's own units, not a percentage error.

The task is different from finding the equation of a line. You may be handed a model without being asked to fit it. Calculate its predictions first, then compare them with the observations. The math homework guide helps identify which quantity a question requests; here it is the remaining signed difference, rather than the slope or the observed response itself.

Keep each prediction on the row of its own observation

Imagine an exercise about assembling small display panels. Let x be the number of panels and y the assembly time in minutes. The table below contains invented teaching values, not results from a workshop or a study. A proposed model is supplied: ŷ = 2x + 3. It allows three minutes of setup plus two minutes per panel, within this hypothetical model.

Invented assembly exercise; supplied model ŷ = 2x + 3
Panels xObserved y (min)Predicted ŷ (min)Residual e (min)
1752
257−2
31091
41011−1

For x = 2, substitute into the model: ŷ = 2 × 2 + 3 = 7 minutes. The corresponding observed time is five minutes. Therefore e = 5 − 7 = −2 minutes. For x = 1, the prediction is five minutes and the observation is seven, giving e = 7 − 5 = +2 minutes. The other rows produce +1 and −1 minute.

Keep the input, observation and prediction together. Comparing the five-minute observation at x = 2 with the five-minute prediction at x = 1 would give a misleading zero. A residual is not the difference between any two convenient entries. The quantities must belong to the same case and the same model. A row-by-row table makes that pairing visible before any subtraction.

A positive residual means the prediction was too low

At x = 1, the observed point lies above the line: seven minutes rather than the predicted five. Its residual is +2 minutes. The model underpredicted this case by two minutes. At x = 2, the observation is below the line: five instead of seven. Its residual is −2 minutes, so the model overpredicted this case by two minutes.

Vertical residuals at the same inputSupplied line ŷ equals two x plus three. For x one to four, predicted times are five, seven, nine, eleven minutes, while observed times are seven, five, ten, ten. Vertical segments link each observed point to its prediction.Time (min)05101234Panels x
Filled circles are observations; open circles are predictions. Vertical segments show raw residuals, using the original invented table.

Positive does not mean a good prediction, and negative does not mean a bad observation. The sign tells you direction; the magnitude tells you the size of the difference in the chosen units. Both +2 and −2 have absolute size two. A zero residual means that this observation equals this model's prediction. It does not certify the model for every other case.

State the subject of your sentence clearly. “The observed time was two minutes lower than predicted” and “the model overpredicted by two minutes” describe the same negative residual. Saying simply “the result was too low” leaves it unclear whether you mean the observed value or the prediction. Name the prediction when using overestimate or underestimate.

A blue plumb cord hangs beside two vertically aligned cobalt marks on a white wall
Compare values at the same horizontal position; this photograph illustrates orientation, not numerical data.

Use a vertical difference and preserve the response units

In a scatter plot with x horizontally and y vertically, a raw residual is a vertical signed gap. Hold x fixed and read the two y-values. The shortest slanted distance from a point to a line is a different geometric measurement. Moving sideways to the line would compare different input values and would not calculate y − ŷ for the original case.

Our residuals are measured in minutes because both y and ŷ are times. Subtracting a number of panels from a number of minutes is meaningless. If the same times were expressed in seconds, the numerical residual −2 minutes would become −120 seconds. Its physical meaning and sign would stay the same. Numerical size alone cannot be compared across different units.

When reading a drawn graph, use the vertical axis scale rather than counting screen pixels. An enlarged picture changes pixel distances without changing a two-minute residual. If a question supplies an equation, substitution usually gives a more precise prediction than estimating from a thick printed line. The word-problem guide develops the habit of keeping quantities and units attached to the numbers you compare.

An adult hand holds an unnumbered measuring strip vertically beside a blue wooden block
Direction and units matter; the strip does not supply a measurement for the assembly exercise.

Try the next step with your own homework.

Bring your question and attempt into Lirno. Ask for a hint, discuss the reasoning, then try the next step yourself.

Get Lirno for iOS

Opposite signs can cancel while individual errors remain

The residuals in our table add to 2 − 2 + 1 − 1 = 0. Every observation still differs from its prediction. The signed total hides the individual gaps. Adding absolute sizes gives 2 + 2 + 1 + 1 = 6 minutes; dividing by four gives a mean absolute difference of 1.5 minutes for these four invented cases. Neither calculation says that every case misses by 1.5 minutes.

Our line was supplied, not claimed to be the least-squares fit. A zero residual sum alone does not establish the best-fitting line. In ordinary unweighted least-squares regression with an intercept, residuals on the fitted data sum to zero, apart from numerical rounding. That property does not apply automatically to every proposed line or to a separate new dataset.

For a counterexample, keep the observations and replace the model with ŷ = 2x + 4. Its predictions become 6, 8, 10 and 12; residuals are +1, −3, 0 and −2, summing to −4 minutes. The subtraction rule is unchanged. The NIST model-validation reference defines residuals against corresponding predictions and explains why one summary number does not establish an adequate model.

A cobalt paper ribbon curves above a white tabletop and falls over its edge between two adult hands
The ribbon changes direction while each section keeps its length; this is a conceptual illustration, not a residual plot.

Use a residual plot to inspect a pattern, not prove a cause

A residual plot can keep x on the horizontal axis and place e on the vertical axis. Our four plotted coordinates would be (1, 2), (2, −2), (3, 1) and (4, −1), with a horizontal zero reference. This is different from the original scatter plot, where the vertical coordinates were observed assembly times. Label the new axis as residual in minutes.

In a larger dataset, a curve or another systematic pattern can suggest that the model misses structure. A widening spread can prompt questions about how variability changes. The UTC lesson on residual graphs explains this diagnostic role. Four invented points are far too little to certify assumptions about a real process; they are here to practice calculation and sign interpretation.

A large residual is a reason to inspect the case, its input, its units and the model. It is not automatic permission to delete the observation. Nor does a small residual show that changing x causes a change in y. Model checking, causal reasoning and checking a copied value are different questions. Explain what the displayed difference actually supports before making a broader claim.

Check the answer by rebuilding the observed value

Suppose your working for the second row says e = 7 − 5 = +2. The arithmetic is correct but the quantities were reversed. Start with the observed five and subtract the predicted seven. You obtain −2. To check the result independently, rearrange the definition: observed = predicted + residual. Seven plus negative two equals five, which reconstructs the original row.

The incorrect +2 would reconstruct 7 + 2 = 9, not five. This check is stronger than memorizing “points below the line are negative” without knowing why. Use both: the picture gives a direction check, and addition checks the numerical relationship. If your calculated sign contradicts the point's position, inspect the observation-prediction pairing before changing the model.

Write a correction note that names the decision: “I subtracted observed from predicted; next time I label y and ŷ before calculating.” The mistake review method helps connect that note with a fresh task. Recording only the corrected number leaves the original sign error easy to repeat when a new equation or context appears.

Try three fresh cases with a different model

Cover the first table. A new hypothetical assembly model is ŷ = 3x + 2 minutes. For x = 2, the observed time is seven minutes; for x = 4, it is sixteen; for x = 3, it is eleven. Calculate each prediction and residual. State which case is overpredicted, which is underpredicted and which matches the model exactly.

The predictions are 8, 14 and 11 minutes. Residuals are 7 − 8 = −1, 16 − 14 = +2 and 11 − 11 = 0 minutes. The model overpredicts the first case by one minute and underpredicts the second by two. The last observation agrees with its prediction. Reconstruct all three: 8 + (−1) = 7, 14 + 2 = 16 and 11 + 0 = 11.

Finish by explaining the sign without referring to the answer list. A positive residual puts the observation above the supplied line at that input, so the prediction was too low. You have checked a difference, not proved a causal relationship or guaranteed future accuracy. On the next problem, begin again with the same three labels: input, observed response and predicted response.

An adult student checks faint graph paper with a pencil and ruler at a bright library drafting table
A different model and new observations test the method beyond the first worked table.

Questions about this method

Does a positive residual mean the model overpredicted?

With e = observed − predicted, it means the opposite: the observation is higher than the prediction, so the model underpredicted. A negative residual indicates overprediction.

Is a residual the shortest distance to the line?

Not in this ordinary regression convention. It is the vertical signed difference at the same input, expressed in the response units. A perpendicular distance is a different quantity.

Does a zero sum of residuals mean a perfect fit?

No. Positive and negative differences can cancel. Inspect individual sizes and patterns. A zero sum for fitted data is a least-squares property under particular conditions, not a universal accuracy guarantee.

Topics
  • Residuals
  • Observed values
  • Predicted values
  • Scatter plots
  • Regression
  • Vertical distance
  • Signed differences
  • Model checking