R: Removing points in regression

From MathWiki

How to remove a point in a regression

Incomplete

library(MASS)
data(hills)
xqplot(hills)
xqplot(hills)
?hills
scatterplot.matrix(hills)
fit <- lm(time ~ distance, hills)
fit <- lm(time ~ dist, hills)
fit
summary(fit)
plot( dist ~ time, hills)
abline(fit)
abline(coefs(fit))
abline(coef(fit))
coef(fit)
abline(coef(fit))
abline(lm(dist ~ time, hills))
fit <- lm(dist ~ time, hills)
plot( dist ~ time, hills)
abline(fit)
identify( time, dist)
with( hills , identify( time,dist, rownames(hills)))
rowns <-with( hills , identify( time,dist, rownames(hills)))
rowns
hills
dd <- hills[ -rowns,]
dd
resid(fit)
abs(resid(fit)) > 2
table(abs(resid(fit)) > 2)
dd <- hills[ !(abs(resid(fit)) > 2),]
dd