Statistical Methods
Audit Residual Contributions to a Huber Loss
Define the task
When reviewing a robust fitting objective, separate the loss definition from the algorithm that minimizes it. Huber loss is quadratic near zero and linear in the magnitude of larger residuals. Prespecify the changepoint delta and the residual scale. A threshold of one means different things for raw measurements and standardized residuals. The accompanying tool evaluates a fixed set of residuals; it does not fit coefficients or identify erroneous observations.
Carry out the check
For absolute residual at most delta, compute half the squared residual. Beyond delta, compute delta times (absolute residual minus half delta). Keep individual contributions alongside the total so a large value cannot disappear inside a summary. Positive delta is required by this teaching tool; the mathematically degenerate zero choice is deliberately rejected. Robust loss reduces the growth of large contributions but does not remove dependence, confounding or the need to inspect measurement problems. Changing units requires changing delta consistently.
Worked hypothetical example
For hypothetical residuals (0,1,3) and delta=1, contributions are 0,0.5,2.5, totaling 3. Ordinary half-squared loss totals 5. The residual of 3 still contributes most; it has not been discarded. Multiplying both residuals and delta by two multiplies every loss by four. Record whether a report uses total or mean loss and retain the threshold with its units. A smaller objective across differently scaled datasets is not automatically better model performance.
Method checked 19 November 2026 against Primary method documentation: scipy.special.huber.