Question: Implement the Best Subset Selection algorithm in R. Algorithm: 1. Let M 0 denote the null model, which contains no predictors. This model simply predicts
Implement the Best Subset Selection algorithm in R.
Algorithm:
1. Let M0 denote the null model, which contains no predictors. This model simply predicts the sample mean for each observation.
2. For k = 1,2, . . . p:
a. Fit all
models that contain exactly k predictors.
b. Pick the best among these
models, and call it Mk. Here best is defined as having the smallest RSS, or equivalently largest R2.
3. Select a single best model from among M0, . . . ,Mp using cross-validated prediction error, Cp(AIC), BIC, or adjusted R2
Transcribed image text
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
