For least-squares linear regression with hat matrix , how do you prove that the leave-one-out residual is , so that leave-one-out cross-validation needs only one fit?
Foundations, Model selection
Level L4 Advanced. Length Long. Nature Mat Mathematical.
What's being asked
Whether you can use a rank-one update of a matrix inverse (the Sherman–Morrison formula) to turn model fits into one.
Key idea
maps the targets to the fitted values, , and is its -th diagonal entry (the leverage of point ). is the prediction at from the model trained without point . Removing row changes by the rank-one term , and Sherman–Morrison inverts that change in closed form. Everything then reduces to dividing by .
Steps
- Set up notation. , , , and . Without point we have and .
- Quote Sherman–Morrison, which gives the inverse after a rank-one change without inverting again:
- Predict at with the leave-one-out model. Write for short. Then
- Simplify using quantities from the full fit: . So .
- Subtract from : Hence , computed from a single fit.
- Interpret. Each lies between 0 and 1, and . Points with near 1 (high leverage) have leave-one-out residuals much larger than their training residuals. The same proof works for ridge, with . Replacing each by the average gives generalised cross-validation (GCV).
Common mistakes
- Sign errors in Sherman–Morrison. Removing a row gives and ; adding a row gives and .
- Forgetting that also changes when point is removed.
- Not noting that the formula needs . If , is singular and the point cannot be predicted without itself.
How long your answer should be
One page; 8–10 minutes.
Last checked on 4 December 2026.
Read this
Previous in Foundations: What does the no-free-lunch theorem say, and what does it imply for choosing a learning algorithm in practice?
Next in Foundations: Does Occam's razor claim that nature itself prefers simple laws, or is there a formal statistical reason to prefer simpler hypotheses that fit the training data — and when can counting parameters mislead you?