Cook's distance

From HandWiki
Short description: Measure of the influence of a data point in regression analysis

In statistics, Cook's distance or Cook's D is a commonly used estimate of the influence of a data point when performing a least-squares regression analysis.[1] In a practical ordinary least squares analysis, Cook's distance can be used in several ways: to indicate influential data points that are particularly worth checking for validity; or to indicate regions of the design space where it would be good to be able to obtain more data points. It is named after the American statistician R. Dennis Cook, who introduced the concept in 1977.[2][3]

Definition

Data points with large residuals (outliers) and/or high leverage may distort the outcome and accuracy of a regression. Cook's distance measures the effect of deleting a given observation. Points with a large Cook's distance are considered to merit closer examination in the analysis.

For the algebraic expression, first define

𝐲n×1=𝐗n×pβp×1+εn×1

where ε𝒩(0,σ2𝐈) is the error term, β=[β0β1βp1]T is the coefficient matrix, p is the number of covariates or predictors for each observation, and 𝐗 is the design matrix including a constant. The least squares estimator then is 𝐛=(𝐗T𝐗)1𝐗T𝐲, and consequently the fitted (predicted) values for the mean of 𝐲 are

y^=𝐗𝐛=𝐗(𝐗T𝐗)1𝐗T𝐲=𝐇𝐲

where 𝐇𝐗(𝐗T𝐗)1𝐗T is the projection matrix (or hat matrix). The i-th diagonal element of 𝐇, given by hii𝐱iT(𝐗T𝐗)1𝐱i,[4] is known as the leverage of the i-th observation. Similarly, the i-th element of the residual vector 𝐞=𝐲y^=(𝐈𝐇)𝐲 is denoted by ei.

Cook's distance Di of observation i(for i=1,,n) is defined as the sum of all the changes in the regression model when observation i is removed from it[5]

Di=j=1n(y^jy^j(i))2ps2

where p is the rank of the model and y^j(i) is the fitted response value obtained when excluding i, and s2=𝐞𝐞np is the mean squared error of the regression model.[6]

Equivalently, it can be expressed using the leverage[5] (hii):

Di=ei2ps2[hii(1hii)2].

Detecting highly influential observations

There are different opinions regarding what cut-off values to use for spotting highly influential points. Since Cook's distance is in the metric of an F distribution with p and np (as defined for the design matrix 𝐗 above) degrees of freedom, the median point (i.e., F0.5(p,np)) can be used as a cut-off.[7] Since this value is close to 1 for large n, a simple operational guideline of Di>1 has been suggested.[8]

The p-dimensional random vector 𝐛𝐛(i), which is the change of 𝐛 due to a deletion of the i-th case, has a covariance matrix of rank one and therefore it is distributed entirely over one dimensional subspace (a line) of the p-dimensional space. However, in the introduction of Cook’s distance, a scaling matrix of full rank p is chosen and as a result 𝐛𝐛(i) is treated as if it is a random vector distributed over the whole space of p dimensions. Hence the Cook's distance measure does not always correctly identify influential observations.[9][10]

Relationship to other influence measures (and interpretation)

Di can be expressed using the leverage[5] (0hii1) and the square of the internally Studentized residual (0ti2), as follows:

Di=ei2ps2hii(1hii)2=1pei21npj=1nε^j2(1hii)hii1hii=1pti2hii1hii.

The benefit in the last formulation is that it clearly shows the relationship between ti2 and hii to Di (while p and n are the same for all observations). If ti2 is large then it (for non-extreme values of hii) will increase Di. If hii is close to 0 then Di will be small, while if hii is close to 1 then Di will become very large (as long as ti2>0, i.e.: that the observation i is not exactly on the regression line that was fitted without observation i).

Di is related to DFFITS through the following relationship (note that σ^σ^(i)ti=ti(i) is the externally studentized residual, and σ^,σ^(i) are defined here):

Di=1pti2hii1hii=1pσ^(i)2σ^2σ^2σ^(i)2ti2hii1hii=1pσ^(i)2σ^2(ti(i)hii1hii)2=1pσ^(i)2σ^2DFFITS2

Di can be interpreted as the distance one's estimates move within the confidence ellipsoid that represents a region of plausible values for the parameters.[clarification needed] This is shown by an alternative but equivalent representation of Cook's distance in terms of changes to the estimates of the regression parameters between the cases, where the particular observation is either included or excluded from the regression analysis.

An alternative to Di has been proposed. Instead of considering the influence a single observation has on the overall model, the statistics Si serves as a measure of how sensitive the prediction of the i-th observation is to the deletion of each observation in the original data set. It can be formulated as a weighted linear combination of the Dj's of all data points. Again, the projection matrix is involved in the calculation to obtain the required weights:

Si=j=1n(y^iy^i(j))2ps2hii=j=1nhij2Djhiihjj=j=1nρij2Dj

In this context, ρij (1) resembles the correlation between the predictions y^i and y^j[lower-alpha 1].
In contrast to Di, the distribution of Si is asymptotically normal for large sample sizes and models with many predictors. In absence of outliers the expected value of Si is approximately p1. An influential observation can be identified if

|Simed(S)|4.5MAD(S)

with med(S) as the median and MAD(S) as the median absolute deviation of all S-values within the original data set, i.e., a robust measure of location and a robust measure of scale for the distribution of Si. The factor 4.5 covers approx. 3 standard deviations of S around its centre.
When compared to Cook's distance, Si was found to perform well for high- and intermediate-leverage outliers, even in presence of masking effects for which Di failed.[12]
Interestingly, Di and Si are closely related because they can both be expressed in terms of the matrix 𝐓 which holds the effects of the deletion of the j-th data point on the i-th prediction:

𝐓=[y^1y^1(1)y^1y^1(2)y^1y^1(3)y^1y^1(n1)y^1y^1(n)y^2y^2(1)y^2y^2(2)y^2y^2(3)y^2y^2(n1)y^2y^2(n)y^n1y^n1(1)y^n1y^n1(2)y^n1y^n1(3)y^n1y^n1(n1)y^n1y^n1(n)y^ny^n(1)y^ny^n(2)y^ny^n(3)y^ny^n(n1)y^ny^n(n)]  =𝐇𝐄𝐆=𝐇[e100000e2000000en100000en][11h110000011h2200000011hn1,n10000011hnn]

With 𝐓 at hand, 𝐃 is given by:

𝐃=[D1D2Dn1Dn]=1ps2diag(𝐓T𝐓)=1ps2diag(𝐆𝐄𝐇T𝐇𝐄𝐆)=diag(𝐌)

where 𝐇T𝐇=𝐇 if 𝐇 is symmetric and idempotent, which is not necessarily the case. In contrast, 𝐒 can be calculated as:

𝐒=[S1S2Sn1Sn]=1ps2𝐅diag(𝐓𝐓T)=1ps2[1h11000001h220000001hn1n1000001hnn]diag(𝐓𝐓T)  =1ps2𝐅diag(𝐇𝐄𝐆𝐆𝐄𝐇T)=𝐅diag(𝐏)

where diag(𝐀) extracts the main diagonal of a square matrix 𝐀. In this context, 𝐌=p1s2𝐆𝐄𝐇T𝐇𝐄𝐆 is referred to as the influence matrix whereas 𝐏=p1s2𝐇𝐄𝐆𝐆𝐄𝐇T resembles the so-called sensitivity matrix. An eigenvector analysis of 𝐌 and 𝐏 - which both share the same eigenvalues – serves as a tool in outlier detection, although the eigenvectors of the sensitivity matrix are more powerful. [13]

Software implementations

Many programs and statistics packages, such as R, Python, Julia, etc., include implementations of Cook's distance.

Language/Program Function Notes
Stata predict, cooksd See [1]
R cooks.distance(model, ...) See [2]
Python CooksDistance().fit(X, y) See [3]
Julia cooksdistance(model, ...) See [4]

Extensions

High-dimensional Influence Measure (HIM) is an alternative to Cook's distance for when p>n (i.e., when there are more predictors than observations).[14] While the Cook's distance quantifies the individual observation's influence on the least squares regression coefficient estimate, the HIM measures the influence of an observation on the marginal correlations.

See also

Notes

  1. The indices i and j are often interchanged in the original publication as the projection matrix 𝐇 is symmetric in ordinary linear regression, i.e., hij=hji. Since this is not always the case, e.g., in weighted linear regression, the indices have been written consistently here to account for potential asymmetry and thus allow for direct usage.[11]

References

  1. Mendenhall, William; Sincich, Terry (1996). A Second Course in Statistics: Regression Analysis (5th ed.). Upper Saddle River, NJ: Prentice-Hall. p. 422. ISBN 0-13-396821-9. "A measure of overall influence an outlying observation has on the estimated β coefficients was proposed by R. D. Cook (1979). Cook's distance, Di, is calculated..." 
  2. Cook, R. Dennis (February 1977). "Detection of Influential Observations in Linear Regression". Technometrics (American Statistical Association) 19 (1): 15–18. doi:10.2307/1268249. 
  3. Cook, R. Dennis (March 1979). "Influential Observations in Linear Regression". Journal of the American Statistical Association (American Statistical Association) 74 (365): 169–174. doi:10.2307/2286747. 
  4. Hayashi, Fumio (2000). Econometrics. Princeton University Press. pp. 21–23. ISBN 1400823838. https://books.google.com/books?id=QyIW8WUIyzcC&pg=PA21. 
  5. 5.0 5.1 5.2 "Cook's Distance". http://se.mathworks.com/help/stats/cooks-distance.html. 
  6. "Statistics 512: Applied Linear Models". Purdue University. https://www.stat.purdue.edu/~jennings/stat514/stat512notes/topic3.pdf#page=9. 
  7. Bollen, Kenneth A.; Jackman, Robert W. (1990). "Regression Diagnostics: An Expository Treatment of Outliers and Influential Cases". in Fox, John; Long, J. Scott. Modern Methods of Data Analysis. Newbury Park, CA: Sage. pp. 266. ISBN 0-8039-3366-5. https://archive.org/details/modernmethodsofd0000unse/page/266. 
  8. Cook, R. Dennis; Weisberg, Sanford (1982). Residuals and Influence in Regression. New York, NY: Chapman & Hall. ISBN 0-412-24280-X. https://books.google.com/books?id=MVSqAAAAIAAJ. 
  9. Kim, Myung Geun (31 May 2017). "A cautionary note on the use of Cook's distance". Communications for Statistical Applications and Methods 24 (3): 317–324. doi:10.5351/csam.2017.24.3.317. ISSN 2383-4757. 
  10. On deletion diagnostic statistic in regression
  11. Peña 2005, p. 2.
  12. Peña, Daniel (2005). "A New Statistic for Influence in Linear Regression". Technometrics (American Society for Quality and the American Statistical Association) 47 (1): 1–12. doi:10.1198/004017004000000662. 
  13. Peña, Daniel (2006). Pham, Hoang. ed. Springer Handbook of Engineering Statistics. Springer London. pp. 523–536. doi:10.1007/978-1-84628-288-1. ISBN 978-1-84628-288-1. https://link.springer.com/referenceworkentry/10.1007/978-1-84628-288-1_28. 
  14. High-dimensional influence measure

Further reading