Understand the idea
Once a regression has found its line, you can put any row's predictor values into the line's equation and get a number back. For a row the model was fitted on, that number is the row's fitted value: the model's estimate of the response for that row. On the penguin regression of body mass on flipper length, the fitted line is body mass = −5,780.8 + 49.69 × flipper length, so the first penguin in the table, with 181 mm flippers, has a fitted body mass of about 3,212 g.
The observed value is what was actually measured for that row: that penguin weighed 3,750 g. The residual is the observed value minus the fitted value, here 3,750 − 3,212 = 538 g, so the line underestimates this penguin by about half a kilogram Residual. A positive residual means the row sits above the line, a negative one below it.
A prediction uses the same equation on a row the model has not seen: a new penguin, or next month's sales. The arithmetic is identical, but the job is different. Each fitted row helped choose the line, and the line was chosen to sit as close to those rows as possible, so on average fitted values sit closer to the data than predictions for new rows will (any single new row can still land closer by luck). That is why a fitted value is not a forecast, and why how well a model predicts is judged on rows it did not see, not on its own fitted values.
KernelStats keeps the two words apart: fitted for a regression-type model's estimate of the response on its own rows, predicted for a classifier's predicted class or probability and for a machine-learning model's output. Fitted values are often written ŷ, read y-hat; a prediction for a new row is also called a predicted value.
Practitioner explanation
For ordinary least squares with a full-column-rank design matrix X, the fitted values are ŷ = Xβ̂ = Hy, with H = X(XᵀX)⁻¹Xᵀ the hat matrix: each fitted value is a weighted sum of all the observed responses, and the weight on a row's own response is its leverage h_ii Leverage. With a correctly specified linear mean and independent homoskedastic errors, a fitted value estimates the mean response E[y | x_i] at that row's predictor values, with estimated standard error s√h_ii; the residual vector is e = y − ŷ = (I − H)y.
Least squares makes the residuals orthogonal to the columns of X, so with an intercept they sum to zero and are uncorrelated with the fitted values. That is why residuals are plotted against fitted values: a curve or a funnel there is structure the model missed. Under a correctly specified fixed-X model with independent homoskedastic errors, Cov(e, y) = σ²(I − H), so residuals plotted against observed y have a built-in positive relationship, not necessarily a model defect.
In-sample fitted values can be optimistic about prediction. For OLS with a full-column-rank fixed design X, a correctly specified linear mean and independent homoskedastic errors of variance sigma squared, the expected residual sum of squares is (n - p) times sigma squared, while the same fitted values compared with independent fresh responses at the same predictor values have expected total squared error (n + p) times sigma squared. Here p is the number of fitted coefficients including any intercept; the expected gap is 2p times sigma squared. This is an expectation, not a guarantee for an individual prediction. The optimism motivates corrections such as Mallows' Cp and AIC and validation on held-out data Cross-validation. A prediction interval describes uncertainty for a single new response, while a confidence interval for the fitted mean answers a different question Prediction interval.
In KernelStats the linear regression card prints the fitted equation (ŷ = …), and Save Columns writes each row's fitted value as "Linear regression fitted" (described as the model's estimate, not a measurement) beside "Linear regression residual"; a row the model did not use stays blank. The vocabulary is fixed across cards: fitted names a model's estimate of the response, predicted names a classifier's or machine-learning model's output, and those saved predictions are in-sample, so they do not establish out-of-sample performance. Linear and logistic regression cards do not automatically provide a cross-validated score; assess prediction with a suitable separate validation procedure.
When to use it
Consider it when
To read what a model says about the rows it was built from: plotting residuals against fitted values, comparing each row with the model's estimate, or saving the estimates for a later step.
Use caution when
As a forecast or as evidence of how well the model predicts new rows: training fit can be optimistic about performance on new rows, so judge prediction on rows the model did not see (cross-validation) and use an appropriate prediction interval for uncertainty about a new response.
Formulas and symbols
Fitted value
beta-hat are the fitted coefficients and x_i1 ... x_ik are row i's predictor values.
Fitted values through the hat matrix
X is the design matrix (a column of ones for the intercept, then the predictors) and y the observed responses.
Residual
y_i is the observed value and y-hat_i the fitted value of row i.
Worked example
Scenario
A linear regression of body mass on flipper length for the 342 penguins with both values; the first penguin in the table has 181 mm flippers and weighs 3,750 g.
Result
ŷ = −5780.831 + 49.686·flipper_length_mm; this penguin's fitted body mass is 3,212 g and its residual is 3,750 − 3,212 = 538 g.
Interpretation
The line's estimate of the mean body mass of penguins with 181 mm flippers is about 3.2 kg, and this penguin is about half a kilogram heavier than that. A new 181 mm penguin would get the same 3,212 g as its point prediction, but how far that prediction may miss is shown by a prediction interval, not by how closely the line runs through the penguins it was fitted on.
Dataset: penguins.csv
Common misconceptions
Misconception
A fitted value is the same as a prediction.
Correction
The arithmetic is the same, the fitted equation at a row's predictor values, but a fitted value is for a row the model was fitted on and a prediction is for a row it has not seen. Each fitted row helped choose the model, so fitted values sit closer to the data than predictions for new rows will, on average; this does not guarantee that every new prediction is farther from its observed value.
Misconception
The fitted values show how accurately the model will predict new data.
Correction
They show how closely the model matches the rows it was built from, which flatters it, because those rows chose the model. How well it predicts new rows is measured on rows it did not see, by cross-validation or a held-out set.
References
- Applied Linear Statistical Models, 5th edition, Kutner, M. H., Nachtsheim, C. J., Neter, J. and Li, W. (2004), Chapters 1, 2 and 5 (fitted values, residuals, the hat matrix).
- KernelStats linear regression card (engine code, Learn More and Save Columns descriptions), KernelStats documentation (2026).
