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.
- Fit a multiple regression model to predict
Sales
using Price
,
Urban
, and US
. Store the model in lm.fit1
.
- Provide an interpretation of each coefficient in the model. Be
careful—some of the variables in the model are qualitative!
- Write out the model in equation form on paper, being careful to handle
the qualitative variables properly.
- 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
- 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.
- Using the model from 4., obtain 95 % confidence intervals for
the coefficient(s). Store the confidence interval in
conf.int.95
.
- Is there evidence of outliers or high leverage observations in the
model from 4.?
Assume that:
- The ISLR2 library has been loaded
- The Carseats dataset has been loaded and attached