AI Glossary / Statistics and probability / Advanced

Lack-of-fit sum of squares

Definition

The lack-of-fit sum of squares is the part of regression residual variation attributable to discrepancies between observed means at replicated predictor settings and the fitted mean function. In a standard replicated least-squares setting, residual sum of squares partitions into pure-error sum of squares plus lack-of-fit sum of squares. The first captures variation among observations at the same setting; the second measures how far the fitted curve lies from those setting means. A positive value is expected from sampling variation even under a correct model, so it is not by itself proof of misspecification.

What it means

Replication provides a way to compare a restrictive mean model with a more flexible model that assigns a separate mean to each observed setting. If a fitted line or surface misses the setting means by more than ordinary within-setting variability would suggest, that supports a lack-of-fit concern. The quantity is expressed in squared response units. Its size depends on replication counts and measurement scale, so it should not be interpreted without degrees of freedom, a reference estimate of error and the practical meaning of the discrepancies.

How it works

Let there be g distinct predictor settings, nᵢ observations at setting i, group mean ȳᵢ and fitted mean ŷᵢ. Then SS_LOF = Σnᵢ(ȳᵢ − ŷᵢ)² and SS_PE = ΣΣ(yᵢⱼ − ȳᵢ)². Because within-setting deviations sum to zero, SSE = SS_PE + SS_LOF. For an ordinary full-rank linear model with p fitted coefficients, degrees of freedom are g − p for lack of fit and N − g for pure error. When both are positive, the classical statistic is F = [SS_LOF/(g − p)]/[SS_PE/(N − g)]. Its exact null F calibration requires the standard independent, equal-variance Gaussian-error assumptions and the stated nested linear-model setup.

Three practical examples

  • Calibration assessment: separate repeatability variation from discrepancies between a fitted line and replicated calibration means.
  • Designed experiments: assess whether a proposed response surface adequately represents the observed combinations of factor settings.
  • Model comparison: quantify the extra residual variation imposed by a particular mean function relative to separate setting means. This does not test prediction outside the measured settings or every other model assumption.

Think of it this way

Think of repeated measurements forming small clouds around several input settings. Pure error describes the scatter within each cloud. Lack-of-fit sum of squares measures the weighted squared distances from the fitted curve to the centers of those clouds. A cloud with more observations receives more weight because its mean is informed by more measurements under the assumed equal-variance sampling model.

Worked example

At x = 0, 1 and 2, observe response pairs (1, 3), (3, 5) and (9, 11). The setting means are 2, 4 and 10. The ordinary least-squares line is ŷ = 4/3 + 4x, giving fitted values 4/3, 16/3 and 28/3. Each pair differs from its own mean by −1 and +1, so SS_PE = 6. Mean-to-line discrepancies are 2/3, −4/3 and 2/3, giving SS_LOF = 2[(2/3)² + (−4/3)² + (2/3)²] = 16/3. Therefore SSE = 6 + 16/3 = 34/3, verified by directly squaring all six residuals. With N = 6, g = 3 and p = 2, the pure-error degrees of freedom are 3 and lack-of-fit degrees of freedom are 1. The F statistic is (16/3)/(6/3) = 8/3. A significance decision requires its appropriate F reference and a chosen level; the sum of squares alone is not a p-value.

Illustrative case study

Fictional case study: Linden Process compares a straight-line calibration with repeated measurements at several controlled settings. Its report initially labels the entire residual sum of squares as lack of fit. The analyst separates within-setting repeatability from the mean-to-line discrepancies and corrects the table. The team then inspects which settings contribute most to SS_LOF and plans new measurements before selecting a revised curve. The corrected partition makes the source of variation clearer without implying that the existing experiment can certify extrapolation beyond its observed range.

Common misconceptions and mistakes

Common mistakes include omitting the nᵢ weights, dividing by the wrong degrees of freedom, and confusing residual mean square with lack-of-fit mean square. Treating measurements at different relevant conditions as replicates can inflate or distort pure error. If g equals p, there are no lack-of-fit degrees of freedom; if N equals g, there are no pure-error degrees of freedom. A zero pure-error estimate makes the ordinary ratio problematic. Unequal variances, dependence or nonlinear-model estimation can require different methods or calibration rather than automatic use of the classical exact F test.

Business use

Businesses can use the partition to distinguish measurement repeatability from limitations of an operational mean model. Design replication deliberately and record all conditions that determine whether observations genuinely share a setting. Report the partition, degrees of freedom, test assumptions and the magnitude of discrepancies in original units as well as squared units. Pair the formal statistic with residual plots. If model terms are selected after inspecting the same lack-of-fit result, use additional validation to assess the revised model rather than treating its improved fit as independent confirmation.

People also ask

Is SS_LOF the same as SSE?

No. In this replicated setting, SSE includes both pure error and lack of fit.

Can SS_LOF be positive under a correct model?

Yes. Setting means fluctuate because observations contain random error.

Can the standard F test be used without replication?

Not through this pure-error comparison, because N − g is then zero.

Check your understanding

Why is the lack-of-fit sum weighted by two in the example?

Answer: Each predictor setting has two observations. The partition allocates the discrepancy between each setting mean and fitted value to both observations at that setting.

Related terms

  • Lack of fit
  • Degrees of freedom
  • pure error
  • residual sum of squares
  • replicated design
  • nested models
  • F test

Learn next

derive the partition by expanding each residual around its setting mean. Repeat the calculation with unequal replication counts, then examine how heteroscedasticity changes the suitability of the pooled pure-error comparison.

More in Statistics and probability

  • Kruskal­Wallis one-way analysis of variance - The Kruskal - Wallis one-way analysis of variance is a rank-based test for comparing independent groups on an ordered or numerical outcome.
  • Kuiper's test - Kuiper's test is a goodness-of-fit or two-sample distribution-comparison test based on the sum of the largest upward and downward differences between...
  • Kurtosis - Kurtosis is a standardized fourth-moment measure of a distribution.
  • Lag operator - The lag operator is a compact notation for shifting a time series backward in time.
  • Land use regression model - A land use regression model is an empirical model that relates measurements at monitoring locations to geographic predictors, then uses those relationships...
  • Latin hypercube design - A Latin hypercube design is a sampling arrangement that spreads a chosen number of runs across every input variable's range or probability distribution.

Sources

Sources: NIST/SEMATECH e-Handbook, Testing for missing or misspecified terms, https://www.itl.nist.gov/div898/handbook/pmd/section4/pmd446.htm (replicate-based partition and degrees of freedom). NIST, Model validation, https://www.itl.nist.gov/div898/handbook/pmd/section4/pmd44.htm. The dataset, independent partition check and fictional case are original illustrations.

Previous: Lack of fit Next: Lag operator

  • Home
  • Daily AI Updates
  • Blog
  • AIFBL Academy
  • AI Glossary
  • Products and Tools
  • Store
  • Free CFO AI Prompt Pack
  • About Shihan Sheriff
  • Privacy Policy
  • Terms of Use
  • Refund Policy
  • Cookie Policy
  • Earnings Disclaimer