In the following exercise, we will work with a model containing several correlated regressors:
- We first load the MASS library, and we then build a dataset that we can later use. It will have two variables (V1, V2) that are severely correlated. And we'll have two other variables (V3-V4) that are very correlated as well. We'll have a fifth variable that is independent from V1-V4. We want to compare Ridge against ordinary least squares and see what happens with these two pairs of variables and for the independent variable. Furthermore, we will wrap everything into a function that plots a boxplot. Our preferred way of doing Ridge is using the glmnet function/package. This allows us to do something slightly more powerful than ...