Answered step by step
Verified Expert Solution
Question
1 Approved Answer
We use Wage data. set which is in the library ISLR2. The Wage data set contains the following variables. library(ISLR2) #head (Wage) 5:1:I.I:|1mar3:r (Wage) modell:
We use Wage data. set which is in the library ISLR2. The Wage data set contains the following variables. library(ISLR2) #head (Wage) 5:1:I.I:|1mar3:r (Wage) modell: waga ~ year + ns(age, df = 1) + education, model2: waga ~ year + ns(age, df = 3) + education, model3: waga ~ year + ns(age, df = 5) + education, model4: waga ~ year + ns(age, df = 7) + education, model5: waga ~ year + ns(age, df = 9) + education.(c) (10 marks) Split the data set (100%) into a training set (70%) and a. test set (30%). Then t modellmode15 on the training set, and calculate the test MSE for each model. Choose the best model. set.seed(11)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started