Tutorials › Regression Analysis (Undergraduate) › Observed Outcomes, Fitted Values, and Residuals in Output

Building and Reading Model Terms · Tutorial 132 of 991

Observed Outcomes, Fitted Values, and Residuals in Output

Distinguish observed outcomes from fitted values and use observed minus fitted to calculate and interpret regression residuals.

Intermediate 9 min read

What You'll Learn

  • Identify an observed outcome, fitted value, and residual in a regression output table
  • Calculate fitted values from an estimated regression equation
  • Verify residuals using observed outcome minus fitted value
  • Interpret positive and negative residuals in the outcome’s units
  • Distinguish a residual from the unobserved model error
  • Check calculations when software output is rounded

Three Quantities for Each Record

A regression output can put an observed outcome beside a fitted value and a residual. These quantities refer to the same record, but they are not interchangeable. The observed outcome is what was recorded; the fitted value is what the estimated regression equation predicts for that record’s predictor values; and the residual is the difference between them. Keeping those roles straight makes it possible to read and check an output table rather than treating its numbers as a collection of unrelated columns.

For example, a model might predict a patient’s waiting time from recorded characteristics. The fitted value is the model’s predicted waiting time for that patient. If the recorded wait was longer, the residual is positive; if it was shorter, the residual is negative. Both the observed outcome and the fitted value are expressed in minutes, so their difference—the residual—is also in minutes.

Definition: For record \(i\), let \(y_i\) be its observed outcome and let \(\hat{y}_i\) be its fitted value from the estimated regression equation. The residual for that record is
$$ e_i = y_i - \hat{y}_i. $$
The residual is the observed outcome minus the fitted value, in that order. Equivalently, \(y_i = \hat{y}_i + e_i\).

The hats and subscripts matter. The observed value \(y_i\) belongs to one record, and \(\hat{y}_i\) is the model’s fitted outcome for that same record. A residual is not the observed outcome itself, nor is it the difference between two different records. In a table, check that the values being compared come from the same row.

The Model Behind the Fitted Value

In a multiple regression, a model for an outcome \(Y_i\) can be written as an additive equation involving predictors \(x_{i1},\ldots,x_{ip}\). Its estimated equation uses estimated coefficients to calculate fitted values:

$$ \hat{y}_i = \hat{\beta}_0 + \hat{\beta}_1 x_{i1} + \cdots + \hat{\beta}_p x_{ip}. $$

Here, \(\hat{\beta}_0,\ldots,\hat{\beta}_p\) are the coefficient estimates used by the model. Substituting record \(i\)'s predictor values into this equation produces \(\hat{y}_i\). Comparing that result with the recorded outcome \(y_i\) produces \(e_i\). The fitted value therefore depends on both the estimated equation and the particular record’s predictors; the residual also depends on that record’s observed outcome.

A statistical model often represents the outcome as a fitted mean structure plus an unobserved error, for example \(Y_i = \beta_0 + \beta_1 x_{i1} + \cdots + \beta_p x_{ip} + \varepsilon_i\). The error \(\varepsilon_i\) is part of the model for the data-generating process and is not directly observed. The residual \(e_i\), by contrast, is calculated from the observed outcome and the fitted value. It can be used as an observable stand-in for examining discrepancies, but it is not identical to the unobserved error.

The usual regression assumptions—such as an appropriate linear mean structure and errors with mean zero conditional on the predictors—matter when interpreting or using the model statistically. Independence and constant error variance are also common assumptions for inference. The arithmetic definition of a residual does not require those assumptions: once an observed outcome and a fitted value are specified, their difference is determined. The examples below focus on reading and checking that arithmetic, not on making an inferential claim about a population.

Worked Example: Calculating Residuals From a One-Predictor Fit

Suppose a hypothetical tutoring program records practice hours \(x\) and a quiz score \(y\), measured in points. The estimated equation is \(\hat{y} = 50 + 4x\). For three records, calculate the fitted values and residuals.

For record A, the student practiced for 2 hours and scored 61 points. Substitute \(x=2\) to find the fitted value:

$$ \hat{y}_A = 50 + 4(2) = 50 + 8 = 58 \text{ points}. $$

The residual is observed minus fitted:

$$ e_A = y_A - \hat{y}_A = 61 - 58 = 3 \text{ points}. $$

The observed score was 3 points above the fitted score. For record B, \(x=5\) hours and \(y=67\) points:

$$ \hat{y}_B = 50 + 4(5) = 70 \text{ points}, \qquad e_B = 67 - 70 = -3 \text{ points}. $$

The negative sign means the observed score was 3 points below the fitted score. For record C, \(x=7\) hours and \(y=81.5\) points:

$$ \hat{y}_C = 50 + 4(7) = 78 \text{ points}, \qquad e_C = 81.5 - 78 = 3.5 \text{ points}. $$

Each residual is in quiz-score points because both quantities being subtracted are scores in points. The calculation does not say that tutoring caused any score difference; it only describes how each observed score compares with the model’s fitted score.

Reading a Multiple-Regression Output Row

The same definitions apply when several predictors appear in the equation. First use the estimated coefficients and the record’s predictor values to identify its fitted value. Then subtract that fitted value from the observed outcome. A convenient check is to add the residual back to the fitted value: the result should reproduce the observed outcome, subject to rounding.

Worked Example: Checking Two Rows in a Multiple-Regression Table

Consider a hypothetical model of clinic waiting time, measured in minutes. It uses the number of prior clinic visits and travel distance in kilometres:

$$ \widehat{\text{wait}} = 8 + 1.2(\text{prior visits}) + 0.3(\text{distance in km}). $$

For patient A, the record shows 2 prior visits, a travel distance of 10 km, and an observed wait of 15.0 minutes. The fitted value is

$$ \hat{y}_A = 8 + 1.2(2) + 0.3(10) = 8 + 2.4 + 3.0 = 13.4 \text{ minutes}. $$

Thus the residual is

$$ e_A = 15.0 - 13.4 = 1.6 \text{ minutes}. $$

The observed wait was 1.6 minutes longer than the fitted wait. For patient B, the record shows 5 prior visits, a distance of 4 km, and an observed wait of 13.9 minutes:

$$ \hat{y}_B = 8 + 1.2(5) + 0.3(4) = 8 + 6.0 + 1.2 = 15.2 \text{ minutes}, $$
$$ e_B = 13.9 - 15.2 = -1.3 \text{ minutes}. $$

Patient B’s observed wait was 1.3 minutes shorter than the fitted wait. The signs differ because the observed outcomes lie on opposite sides of their respective fitted values. Neither sign changes the definition: in both rows, the observed wait is the first number in the subtraction.

Key relationship: For every row, the observed outcome can be reconstructed from the fitted value and residual: \(y_i = \hat{y}_i + e_i\). A positive residual places the observation above its fitted value; a negative residual places it below. The observed outcome, fitted value, and residual all use the outcome’s units.

Verifying Output When Values Are Rounded

Software may calculate a fitted value and residual using more decimal places than it displays. As a result, subtracting the printed fitted value from the printed observed outcome may not reproduce the printed residual exactly. A small discrepancy can be a consequence of rounding rather than a calculation error. To check carefully, use the full-precision values when available; otherwise, compare values at the precision shown and allow for rounding.

Worked Example: Explaining a Small Rounding Difference

Suppose an output table displays an observed outcome of 24.7 units, a fitted value of 22.4 units, and a residual of 2.3 units. At the displayed precision, the residual check is

$$ 24.7 - 22.4 = 2.3 \text{ units}. $$

Now suppose the underlying calculations used an observed value of 24.70 and a fitted value of 22.36. The full-precision calculation is

$$ e = 24.70 - 22.36 = 2.34 \text{ units}. $$

Rounded to one decimal place, the fitted value is 22.4 and the residual is 2.3. These displayed numbers are consistent with the more precise calculation. Rounding each column separately can sometimes make the displayed subtraction differ by a final digit, but it should not produce a substantial discrepancy.

A second row might display an observed value of 18.9, a fitted value of 20.2, and a residual of \(-1.3\). This agrees directly at the displayed precision:

$$ 18.9 - 20.2 = -1.3 \text{ units}. $$

Because this residual is negative, the observed outcome is below its fitted value. The sign and the subtraction order remain just as important when the output is rounded.

A Short Justification of the Residual Identity

The defining equation \(e_i = y_i - \hat{y}_i\) immediately gives a useful reconstruction check. Add \(\hat{y}_i\) to both sides:

$$ e_i + \hat{y}_i = (y_i - \hat{y}_i) + \hat{y}_i = y_i - \hat{y}_i + \hat{y}_i = y_i. $$

The fitted-value terms cancel, leaving the observed outcome. This proves \(y_i = \hat{y}_i + e_i\). It also verifies the sign interpretation: if \(e_i>0\), then \(y_i>\hat{y}_i\); if \(e_i<0\), then \(y_i<\hat{y}_i\); and if \(e_i=0\), the observed and fitted outcomes are equal. Zero residual means an exact match for that record, not that the model is exact for every record.

Common Mistakes and a Reliable Check

A frequent mistake is to calculate fitted minus observed and label the result a residual. That reverses the sign. If an observed outcome is 12 and the fitted value is 15, the residual is \(12-15=-3\), not \(15-12=3\). The correction is to write the definition first—observed minus fitted—and then substitute the values in that order.

Another mistake is to interpret a residual as a model coefficient or as an unobserved error. A coefficient is part of the estimated equation; a residual is a record-specific difference in outcome units. The model error is not observed, while the residual can be calculated from the output and data. Also avoid saying that a positive residual means the model “overpredicted”: if the observation exceeds the fit, the model’s fitted value is below the observed outcome for that record.

When checking a table, use a consistent three-part routine: confirm that the outcome and fitted value belong to the same row, calculate observed minus fitted, and check that fitted plus residual reconstructs the observed outcome. Then confirm that all three quantities are expressed in the outcome’s units. This simple procedure catches many sign, row-matching, and interpretation errors without requiring any additional model calculations.

Check Your Understanding

Use the definitions and checks in this tutorial to answer the questions.

  1. A record has an observed outcome of 42 units and a fitted value of 39 units. Calculate its residual and interpret the sign in context.
  2. A software table reports an observed outcome of 18 minutes and a residual of \(-2\) minutes. What is the fitted value?
  3. In your own words, distinguish a residual from the unobserved model error.
  4. For a row with observed outcome 9.6 and fitted value 11.1, calculate the residual and state whether the observation is above or below its fitted value.
  5. Why might subtracting rounded values printed in an output table fail to reproduce its displayed residual exactly?