Using the Boston dataset:
sample() function to create a train set and store it in train (sample 300 observations out of 506)lm.fit1 with medv as the response and lstat as the predictorlm.fit2 where you add a second order term of lstatlm.fit3 where you add a second order and third order term of lstatFor each model calculate the validation \(MSE\) and store them in mse1, mse2 and mse3 respectively
lm.fit1lm.fit2lm.fit3Assume that:
MASS library has been loadedBoston dataset has been loaded and attached