Cut-off and Cook’s distance plot with abline

Using the Faraway package and the stackloss data. I cannot put in an abline when plotting the influential points in my data using the cutoff and Cooks distance code below:

fit <- lm(stack.loss ~ ., data=stackloss)
summary(fit)

qqPlot(fit,labels=row.names(stack.loss), id.method= "identify",
simulate=TRUE, main="QQ Plot")

outlierTest(fit)

fitted(fit)["21"]
fitted(fit) ["4"]

cutoff <- 4/(nrow(stack.loss)-length(fit$coefficients)-2)
plot(fit, which=4, cook.levels=cutoff)
abline(h=cutoff, lty=2, col="red")

Everything in this code works except for the abline. Any assistance is greatly appreciated in this matter.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.