# R script for the Effect of an Influence Point Example. x <- c(3, 3.6, 3.7, 4, 4.5) y <- c(1, 0.9, 1.3, 2.0, 2.2) model1 <- lm(y ~ x) x <- c(x, 1) y <- c(y, 4) model2 <- lm(y ~ x) png("c:/datasets/influence-graph.png") plot(x, y, pch=16, xlim=c(0, 5), ylim=c(0, 5), main="Example: Effect of an Influence Point") abline(model1, col="red", lty=2) abline(model2, col="red", lty=1) text(1.7, 4.0, "Influence Point") text(1.8, 2.7, "Regression line with influence point included") text(1.8, 0.3, "Regression line with influence point omitted") dev.off( )