Using the Carseats dataset:
Carseats dataset, with Sales as the response and all other variables as predictors.
Store the output of the regsubsets() function in regfit.full. Set the nvmax option to 5.which.max() function, determine the optimal amount of predictors based on the \(\bar R^2\) and store the result in n.predictors.Age variableEducation variable
Assume that:
ISLR2 and leaps libraries have been loadedCarseats dataset has been loaded and attached