Algorithm Search⌘K

Definitioncore

Cook's distance

Also called Cook's D.

A measure of the influence of one observation: how far all fitted values move when it is deleted, scaled by p times the residual variance.

Cook's distance DiD_i measures the influence of observation ii on a least squares fit: how much all the fitted values move when that observation is deleted, in units of pp times the estimated error variance. It combines the two ingredients of influence, the size of the studentized residual (is the point off the line?) and the leverage (can the point move the line?). R. Dennis Cook introduced it in 1977. It is computed from one fit, without nn refits. It is a descriptive measure, not a test, and it looks at one point at a time.

Definition

Let y=Xb+εy = Xb + \varepsilon with XX an n×pn \times p matrix of rank pp (intercept included in the pp columns) and bb the coefficient vector. Let b^\hat b be the least squares estimate, y^=Xb^\hat y = X\hat b, e=y−y^e = y - \hat y and s2=∑ej2/(n−p)s^2 = \sum e_j^2/(n - p). Let b^(i)\hat b_{(i)} be the estimate without observation ii and y^(i)=Xb^(i)\hat y_{(i)} = X\hat b_{(i)}, the fitted values of all nn points from that fit. Assume hii<1h_{ii} < 1. Cook's distance of observation ii is

Di=∥y^−y^(i)∥2p s2=(b^−b^(i))⊤X⊤X(b^−b^(i))p s2.D_i = \frac{\lVert \hat y - \hat y_{(i)}\rVert^2}{p\,s^2} = \frac{(\hat b - \hat b_{(i)})^\top X^\top X(\hat b - \hat b_{(i)})}{p\,s^2}.

The two forms agree because y^−y^(i)=X(b^−b^(i))\hat y - \hat y_{(i)} = X(\hat b - \hat b_{(i)}).

One-fit formula. By the Sherman-Morrison formula, b^−b^(i)=(X⊤X)−1xi ei/(1−hii)\hat b - \hat b_{(i)} = (X^\top X)^{-1}x_i\,e_i/(1 - h_{ii}). Substituting, with xi⊤(X⊤X)−1xi=hiix_i^\top(X^\top X)^{-1}x_i = h_{ii},

Di=ei2 hiip s2(1−hii)2=ri2p⋅hii1−hii,D_i = \frac{e_i^2\,h_{ii}}{p\,s^2(1 - h_{ii})^2} = \frac{r_i^2}{p}\cdot\frac{h_{ii}}{1 - h_{ii}},

where ri=ei/(s1−hii)r_i = e_i/(s\sqrt{1 - h_{ii}}) is the internally studentized residual. The first factor measures the outlyingness of yiy_i; the second, hii/(1−hii)h_{ii}/(1 - h_{ii}), grows without bound as hii→1h_{ii} \to 1. All nn distances cost O(np2)O(np^2) for the QR factorization and O(np)O(np) after it.

Reading the size. The 100(1−α)%100(1 - \alpha)\% confidence ellipsoid for bb under normal errors is {β:(β−b^)⊤X⊤X(β−b^)≤p s2F(p,n−p,1−α)}\{\beta : (\beta - \hat b)^\top X^\top X(\beta - \hat b) \le p\,s^2 F_{(p, n-p, 1-\alpha)}\}. So Di=F(p,n−p,1−α)D_i = F_{(p, n-p, 1-\alpha)} means that deleting observation ii moves the estimate to the boundary of that ellipsoid. Cook proposed to judge DiD_i by the percentile of Fp,n−pF_{p, n-p} that it reaches; for example, DiD_i near the median of Fp,n−pF_{p, n-p} (about 1 for moderate n−pn - p) moves the estimate to the edge of a 50% confidence region. His paper gives no fixed cutoff. The rules Di>1D_i > 1 and Di>4/nD_i > 4/n, common in software, are later conventions. DiD_i does not have an F distribution: the F percentiles are a ruler, not a null law, so "DiD_i is significant" has no meaning.

Scale. DiD_i does not change when yy is multiplied by a constant or when XX is replaced by XAXA for a nonsingular AA: it depends only on the fitted values.

Examples and non-examples

Six points, one far in xx. For x=(1,2,3,4,5,10)x = (1, 2, 3, 4, 5, 10) and y=(2,3,5,4,6,4)y = (2, 3, 5, 4, 6, 4), p=2p = 2, s2=2.1016s^2 = 2.1016. With the leverages and residuals of the studentized residual example:

ii hiih_{ii} rir_i DiD_i percentile of F2,4F_{2,4}
1 0.3639 −1.2449-1.2449 0.4434 0.33
2 0.2590 −0.4939-0.4939 0.0426 0.04
3 0.1934 0.9267 0.1030 0.10
4 0.1672 0.0223 0.00005 0.00
5 0.1803 1.4114 0.2191 0.19
6 0.8361 −1.7595-1.7595 7.8947 0.96

For F2,νF_{2, \nu} the CDF is 1−(1+2x/ν)−ν/21 - (1 + 2x/\nu)^{-\nu/2}, which gives the last column. Exact arithmetic gives D6=202419/25640D_6 = 202419/25640. Refitting without point 6 gives the line 1.3+0.9x1.3 + 0.9x instead of 3.2623+0.1770x3.2623 + 0.1770x; the sum of squared changes of the six fitted values divided by 2s22s^2 is again 7.89477.8947, exactly. Deleting point 6 moves the estimate to just outside the 95% confidence ellipse of the full fit. Point 1 has the second largest leverage and a moderate residual; D1=0.44D_1 = 0.44 is about half the median of F2,4F_{2,4}, which is 2(2−1)=0.832(\sqrt 2 - 1) = 0.83.

High leverage, no influence. If y6y_6 is changed to 10.3, which lies on the line through the other five points, then e6=0e_6 = 0 and D6=0D_6 = 0 although h66=0.836h_{66} = 0.836.

Masking: two far points hide each other. Duplicate the far point: x=(1,2,3,4,5,10,10)x = (1, 2, 3, 4, 5, 10, 10), y=(2,3,5,4,6,4,4)y = (2, 3, 5, 4, 6, 4, 4). Each copy now has hii=0.455h_{ii} = 0.455, below 2p/n=0.5712p/n = 0.571, and Di=0.135D_i = 0.135, a small value, because deleting one copy leaves the other in place. Deleting both copies at once moves the fitted values by a generalized Cook's distance ∥y^−y^(6,7)∥2/(2s2)=20.1\lVert\hat y - \hat y_{(6,7)}\rVert^2/(2s^2) = 20.1. One-at-a-time diagnostics miss clusters of influential points.

Non-example: the largest residual. In the six-point example the largest ∣ei∣|e_i| is at x=5x = 5, whose D5=0.22D_5 = 0.22 is modest. The most influential point has only the third largest residual.

Non-example: a test for outliers. DiD_i has no null distribution to compare with. An outlier test uses the externally studentized residual tit_i with a Bonferroni cutoff.

  • DFFITS. DFFITSi=tihii/(1−hii)\mathrm{DFFITS}_i = t_i\sqrt{h_{ii}/(1 - h_{ii})}, the change of the own fitted value y^i−y^i(i)\hat y_i - \hat y_{i(i)} divided by s(i)hiis_{(i)}\sqrt{h_{ii}}. It uses s(i)s_{(i)} instead of ss, and Di=s(i)2p s2DFFITSi2D_i = \frac{s_{(i)}^2}{p\,s^2}\mathrm{DFFITS}_i^2. Belsley, Kuh and Welsch suggest the cutoff 2p/n2\sqrt{p/n}.
  • DFBETAS. The change of one coefficient, (b^j−b^j(i))/(s(i)[(X⊤X)−1]jj)(\hat b_j - \hat b_{j(i)})/(s_{(i)}\sqrt{[(X^\top X)^{-1}]_{jj}}), with the cutoff 2/n2/\sqrt n.
  • Leverage and residual. DiD_i is the product of a function of rir_i and a function of hiih_{ii}; the hat matrix gives both.
  • Influence function. The infinitesimal version: the derivative of an estimator with respect to the weight of one point. For least squares it is unbounded in both xx and yy, which is why robust fits such as the Huber M-estimator (bounded in yy) and least trimmed squares (bounded in both) exist.
  • Generalized Cook's distance. For a set II of deleted points, ∥y^−y^(I)∥2/(p s2)\lVert\hat y - \hat y_{(I)}\rVert^2/(p\,s^2), as in the masking example. The number of subsets grows exponentially, which is why multiple-case diagnostics use robust fits instead of enumeration.

References

  1. R. Dennis Cook, Detection of influential observation in linear regression, Technometrics 19(1), 1977, pp. 15 to 18, The whole paper (the definition of D_i through the confidence ellipsoid, the closed form in the studentized residual and the leverage, and the comparison with percentiles of F(p, n - p))
  2. R. Dennis Cook and Sanford Weisberg, Residuals and Influence in Regression, Chapman and Hall, 1982, Chapter 3 (the assessment of influence, Cook's distance and the deletion of several cases)
  3. David A. Belsley, Edwin Kuh and Roy E. Welsch, Regression Diagnostics, Wiley, 1980, Chapter 2 (the deletion diagnostics DFBETAS and DFFITS and their cutoffs)
  4. George A. F. Seber and Alan J. Lee, Linear Regression Analysis, second edition, Wiley, 2003, Section 10.6.3 (leave-one-out case diagnostics, including Cook's D)

About this page

The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.

LadderLevelWhat the next level needs
Human proofH0 no proof
  • add a proof in proofs/ (06.5)
LeanL0 no Lean part
  • name a Lean module in the lean field (07)
VisualV0 none
  • add viz/scene.ts or a figure (10)
WritingW4 complete
  • a review of the text: no review record reviews/AX73CB/text.yaml