This question should be answered using the Carseats data set from the ISLR2 package.

Questions

Some of the exercises are not tested by Dodona (for example the plots), but it is still useful to try them.

  1. Fit a multiple regression model to predict Sales using Price, Urban, and US. Store the model in lm.fit1.
  2. Provide an interpretation of each coefficient in the model. Be careful—some of the variables in the model are qualitative!
  3. Write out the model in equation form on paper, being careful to handle the qualitative variables properly.
  4. For which of the predictors can you reject the null hypothesis \(H_0 : \beta_j = 0\)? On the basis of your response, fit a smaller model that only uses the predictors for which there is evidence of association with the outcome. Store the model in lm.fit2
  5. How well do the models in 1. and 4. fit the data? Store the \(R^2\) of both models in r.squared1 and r.squared2, respectively.
  6. Using the model from 4., obtain 95 % confidence intervals for the coefficient(s). Store the confidence interval in conf.int.95.
  7. Is there evidence of outliers or high leverage observations in the model from 4.?

Assume that: