I am trying to eliminate the categorical outliers and influential data points in the faraway infmort dataset. Every time I try to use the cooks distance to get rid of them, I wipe out all of my data. The outliers are Saudi Arabia, Afghanistan, Nigeria. Any assistance in this matter is greatly appreciated.
library(faraway)
data(infmort)
IMR<-infmort
IMR <- na.omit(IMR)
summary(IMR)
lm.1=lm(mortality~., IMR)
summary(lm.1)
plot(lm.1)
influential <- as.numeric(names(cooks.distance>1) )
IMR <- IMR[-influential,] <- this where the data disappears