8
$\begingroup$

According to my understanding, Cook's distance measures the influence of each observation by excluding points when fitting a model. So I assume it could be an reasonable approach for outlier detection?

My questions, assume data are categorized into groups, is it possible to use Cook's distance on detecting the "outlier" group instead of outlier point? Is Cook's distance a good choice of measuring group influence.

$\endgroup$
4
  • $\begingroup$ Can you make a factor variable for the grouping and then do plots? $\endgroup$
    – conv3d
    Commented Apr 8, 2016 at 23:20
  • $\begingroup$ Thank you, I just noticed there's a group option in influence(). I have another questiona about the threshold. Since the usual 4/N is "too sensitive" detecting outlier, while I only care about extreme influential group/point. @jchaykow $\endgroup$
    – Roy C
    Commented Apr 9, 2016 at 0:18
  • 1
    $\begingroup$ For smaller datasets Cook's D cutoff can be 1. $\endgroup$
    – conv3d
    Commented Apr 9, 2016 at 0:22
  • $\begingroup$ @jchaykow It works well on some of my datasets, not really small datasets though. I'll try it on others later. Is it some kind of rule of thumb, and how should I interpret this cutoff? Thank you. $\endgroup$
    – Roy C
    Commented Apr 9, 2016 at 2:19

2 Answers 2

3
$\begingroup$

Like you said Cook’s Distance measures the change in the regression by removing each individual point. If things change quite a bit by the omission of a single point, than that point was having a lot of influence on your model. Define $\hat{Y}_{j(i)}$ to be the fitted value for the jth observation when the ith observation is deleted from the data set. Cook’s Distance measures how much $i$ changes all the predictions.

$$D_i = \frac{\sum_{j=1}^{n}\hat{Y}_j - \hat{Y}_{j(i)})^2}{pMSE}$$ $$= \frac{e_i^2}{pMSE}[\frac{h_{ii}}{(1-h_{ii})^2}]$$

If $D_i \geq 1$ it is extreme (for small to medium datasets).

Cook’s Distance shows the effect of the ith case on all the fitted values. Note that the ith case can be influenced by

  1. big $e_i$ and moderate $h_{ii}$

  2. moderate $e_i$ and big $h_{ii}$

  3. big $e_i$ and big $h_{ii}$

In R, use the influence.measures package with cooks.distance(model)

$\endgroup$
5
  • $\begingroup$ Thanks for clarifying the definition. But my question is more about whether the $\endgroup$
    – Roy C
    Commented Apr 9, 2016 at 3:18
  • $\begingroup$ @DaisyLee your comment got cut off $\endgroup$
    – conv3d
    Commented Apr 9, 2016 at 3:25
  • $\begingroup$ Lol, just noticed it's you. Thanks for clarifying the definition. I want to ask whether the idea of extend the use of Cook's distance to detecting the outlier group instead of some points is erroneous, or reasonable? And how do you think of using boxplot/IQR to cut off extreme influential cooks distances? $\endgroup$
    – Roy C
    Commented Apr 9, 2016 at 3:31
  • 1
    $\begingroup$ Using Cook's Distance won't work based on the nature of the method (i.e. removing each point individually). If you simply want to check for outlier of a variable based on your groups with sd or a similar method as you state above, this is no problem... df1 = df %>% group_by(grouping) %>% filter(!(abs(value - median(pred1)) > 2*sd(pred1))) %>% summarise_each(funs(mean), pred1) $\endgroup$
    – conv3d
    Commented Apr 9, 2016 at 3:43
  • $\begingroup$ @DaisyLee beyond this I'm out of ideas unfortunately. Maybe someone else can assist more. $\endgroup$
    – conv3d
    Commented Apr 9, 2016 at 3:52
2
$\begingroup$

Cook's D is ineffective in detecting cluster of outliers because removing one of those will not affect the model too much (there're still other outliers).

You could use the residual as a measure, which is sensitive to clusters. A simple implementation of k-means is also effective.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.