In [ ]:
library(ISLR)
summary(Carseats)

In [ ]:
lm.fit <- lm(Sales ~ Price + Urban + US, data = Carseats)
summary(lm.fit)

b)

Price: negative relation UrbanYes: No significant relation USYes: positive relation

c)

$$Sales = -0.054459 * \text{Price} + -0.021916 * \text{UrbanYes} + 1.200573 * \text{USYes}$$

d)

  • Price
  • USYes

In [ ]:
lm.fit2 <- lm(Sales ~ Price + US, data = Carseats)
summary(lm.fit2)

In [ ]:
confint(lm.fit2)

In [ ]:
plot(predict(lm.fit2), rstudent(lm.fit2))