In [ ]:
library(ISLR)

In [ ]:
summary(Auto)

In [ ]:
fit1 <- lm(mpg ~ horsepower, data = Auto)

In [ ]:
summary(fit1)

In [ ]:
plot(mpg ~ horsepower, data = Auto)
abline(fit1, col = "red")

In [ ]:
names(fit1)

In [ ]:
confint(fit1)

In [ ]:
predict(fit1, data.frame(horsepower = c(98)), interval = "confidence")

In [ ]:
predict(fit1, data.frame(horsepower = c(95)), interval = "prediction")

In [ ]:
par(mfrow = c(2,2))
plot(fit1)