I'm trying to use Cook's Distance in order to detect outliers in high-dimensional datasets.
However, I've found some troubles in order to do such thing. Usually, once I've built the linear model and compute Cook's Distance, all I get is a vector full of NaN values.
I've created a fictional example to show my problem.
set.seed(100) data <- as.data.frame(cbind(Class=sample(c(1,2),100,replace=T),matrix(runif(10000,min=-10,max=100),nrow=100)))
With this dataset, I've computed Cook's distance with two different subsets of markers:
# Full of NaN values mod <- lm(formula=Class ~ ., data=data) cooksd <- cooks.distance(mod) print(cooksd)
# Values different from NaN mod <- lm(formula=Class ~ ., data=data[,c(1:51)]) cooksd <- cooks.distance(mod) print(cooksd)
So, I don't know if:
- Cook's distance is not suitable for this kind scenarios
- A vector full of NaN values mean that there is no influence between points
- Cook's distance is sensitive to high number of features