Starting from the null model, apply the forward stepwise selection algorithm to produce a sequence of sub-models iteratively,

statistics

Description

1986 and his whole career. Write R functions to perform variable selection using best subset selection partnered with BIC (Bayesian Information Criterion):

1) Starting from the null model, apply the forward stepwise selection algorithm to produce a sequence of sub-models iteratively, and select a single best model using the BIC. Plot the “BIC vs Number of Variables” curve. Present the selected model with the corresponding BIC.

2) Starting from the full model (that is, the one obtained from minimizing the MSE/RSS using all the predictors), apply the backward stepwise selection algorithm to produce a sequence of sub-models iteratively, and select a single best model using the BIC. Plot the “BIC vs Number of Variables” curve. Present the selected model with the corresponding BIC.

3) Are the selected models from 1) and 2) the same?

Problem 2 In this problem, we fit ridge regression on the same dataset as in Problem 1. First, standardize the variables so that they are on the same scale. Next, choose a grid of ? values ranging from ? = 1010 to ? = 10−2 , essentially covering the full range of scenarios from the null model containing only the intercept, to the least squares fit. For example: > grid = 10^seq(10, -2, length=100)