Lawfare Group → Knowledge Institute → Lawfare Academy

← Course syllabus · Related lesson

A small residual can hide a decisive observation

Current complete on-site edition 6

Required teaching and complete optional models are supplied on LawfareGroup.com. Publisher and primary links are optional provenance or further reading. Florida is the contemporary state-law default; federal rules and explicitly comparative accounting frameworks are distinguished. Independent subject review and observed human learner testing remain pending.

Cumulative regression and forecasting dossier, transfer models and 30-point rubric

Preserved original teaching integrated with complete current on-site preparation. Independent human subject review and observed learner testing remain pending.

A fitted residual measures disagreement after fitting

A supervisor fits a linear relation between batch size x and processing time y. Four observations follow y=2x: (1,2), (2,4), (3,6), (4,8). A fifth record is (20,0). It is tempting to inspect only the final fitted residuals and dismiss any record whose residual is small as harmless. But the fitted line was selected using that very record. An observation can pull the model toward itself and thereby reduce its own residual.

Distinguish three ideas. An unusual predictor configuration has high leverage; leverage measures potential influence from the design geometry. A response unusual relative to an appropriate fitted relation is a different kind of discrepancy. Influence concerns how an estimate or prediction changes when a record's contribution changes. The terms are related but are not interchangeable deletion labels. A large, legitimate batch may be informative and should not be removed merely because its predictor value is unusual.

Reconstruct the full-data fit

For x=[1,2,3,4,20], x-bar=6. For y=[2,4,6,8,0], y-bar=4. The centered predictor squared sum is 250 and the cross-product sum is −60, giving slope −0.24 and intercept 5.44. The fitted times are [5.20,4.96,4.72,4.48,0.64]. Residuals are [−3.20,−0.96,1.28,3.52,−0.64], with squared sum 25.6. The originally increasing relation has become a decreasing fitted line.

For simple regression with an intercept, the fifth observation's leverage is h5=1/5+(20−6)²/250=0.984. Its ordinary residual is only −0.64, yet almost all the geometric leverage is concentrated there. The sum of all leverages equals two, the number of fitted coefficients. That identity can check an implementation, but it is not a substantive argument that the design adequately covers the operating range.

Compare a fit that did not see the outcome

Remove the fifth observation as a sensitivity calculation and refit the remaining four. Their line is exactly y=2x, so its prediction at x=20 is 40. The held-out fifth response is zero, giving a deleted residual of −40. For this full-rank least-squares setting, the same value follows from e5/(1−h5)=−0.64/0.016=−40. The gap between the ordinary and deleted residual shows why judging influence from the final ordinary residual alone can fail.

Deletion here is an analytic counterfactual, not an instruction to discard the record. The remaining four points contain no batch size near twenty, so their prediction at twenty extrapolates far beyond their range. The sensitivity establishes that conclusions depend strongly on one unusual design point; it does not establish which line is the true process relation. Both data validity and model form require investigation. A two-regime process, a saturated timer or a unit conversion error are distinct explanations with different remedies.

Investigate provenance without selecting the desired slope

Check the fifth record's original source, units, measurement timestamps, task definition and eligibility. If zero means a failed timer or a canceled batch rather than a true processing time, correct the data model and preserve the original record and reason for revision. If it is a genuine completed batch under different machinery, document that mechanism and consider whether the target population includes it. Do not use the sign of the coefficient as the rule for deciding whether a record belongs.

A useful comparison changes only y5 from 0 to 40 while leaving x fixed. All five points now follow y=2x. The fifth observation still has leverage 0.984, but its residual is zero and deleting it leaves the same fitted line. High leverage describes sensitivity potential; actual influence also depends on response disagreement. Conversely, a response discrepancy near the center can have a large residual with a different effect on slope than an extreme predictor point. Inspect the full pattern and the business decision, not one diagnostic cutoff.

A decision memo should show the all-record fit, the sensitivity fit, the provenance findings and the target of prediction. If the business will routinely process large batches, collect reliable observations across that range rather than accepting a model determined by one case. If a future validation set is used to choose which records or models to retain, reserve a new evaluation or label the result exploratory. Robust fitting or ridge may reduce some numerical sensitivity, but neither identifies a data error or a causal effect by itself. The objective is a reproducible account of what the evidence can support, including where it is weak.

A diagnostic is a question generator

The full-data slope is −.24; the four-case sensitivity slope is 2. The fifth ordinary residual is −.64, leverage .984 and deleted residual −40. Those numbers justify investigating the dependence of the conclusion on this case. They do not justify reporting only the favorable slope of 2. If provenance confirms the record is valid, preserve it and revisit the process model or the intended population. The laboratory asserts both fits and the changed-response case so that a visual impression cannot substitute for arithmetic.

Progressive independent practice

Write your analysis before opening each model. Then change the stated fact and revise the reasoning.

Guided

Compute the fifth ordinary residual, leverage and deleted residual. Explain their different questions.

Compare the model reasoning

The values are −.64, .984 and −40. The ordinary residual assesses agreement after using the point; leverage describes its predictor geometry; the deleted residual compares it with a fit that omitted it.

Changed conditions

Set the fifth response to 40.

Compare the revised analysis

Leverage stays .984 because x is unchanged. All points lie on y=2x, so the ordinary residual is zero and the sensitivity slope remains 2.

Independent

A colleague deletes the fifth case because a positive slope is more plausible. Write a correction.

Compare the model reasoning

Retain and report the sensitivity result, investigate the source and eligibility rule, and preserve the full-data estimate. Plausibility motivates investigation but does not authorize outcome-driven deletion.

Changed conditions

The original log proves the timer failed and zero was a sentinel.

Compare the revised analysis

Recode the failed measurement according to a documented policy, retain provenance and assess missingness. A verified invalid measure is different from a valid inconvenient outcome.

Transfer

The business predicts large batches using the four-case fit. What evidence is missing?

Compare the model reasoning

All retained predictor values are between one and four. Obtain reliable observations across the large-batch range and evaluate later performance under the intended process. The deleted prediction at twenty is extrapolation, not a measured truth.

Changed conditions

A robust model predicts well on the same data used to choose its tuning settings.

Compare the revised analysis

That is development evidence. Preserve the tuning procedure and use an untouched evaluation design before claiming prospective improvement; numerical robustness does not establish causal validity.

Source readings and scope

NIST Dataplot: regression diagnostics — Background reading on diagnostic distinctions. Five-point construction, exact fits and investigation exercises are original.

Penn State STAT 501: influential points — Additional university reading on leverage and influence; source availability may vary.

Reproduce the worked cases

Download the Python 3 laboratory. Uses only the standard library and synthetic data. Run locally; it does not access accounts, a network service or production records. Assertions check the stated results.