Question: I need help with the R code to draw simulations and update testing and training rmse. If someone can provide an example with made up
I need help with the R code to draw simulations and update testing and training rmse. If someone can provide an example with made up numbers for the values of study_2 (since it's a very large data set)

Simulation Study 2: Using RMSE for Selection? In homework we saw how Test RMSE can be used to select the "best" model. In this simulation study we will investigate how well this procedure works. Since splitting the data is random, we don't expect it to work correctly each time. We could get unlucky. But averaged over many attempts, we should expect it to select the appropriate model. We will simulate from the model where 6 ~ N(0, o') and . Bo = 0, . B1 = -5, . B2 = 4, . B3 = 1.6, . B4 = -1.1, . 85 = 0.7, Bo = 0.3. We will consider a sample size of 500 and three possible levels of noise. That is, three values of o. . n = 500 . DE (1, 2, 4) Use the data found in study_2. cv for the values of the predictors. These should be kept constant for the entirety of this study. The y values in this data are a blank placeholder. Each time you simulate the data, randomly split the data into train and test sets of equal sizes (250 observations for training, 250 observations for testing). For each, fit nine models, with forms: y ~ x1 y ~ x1 + x2 y ~ X1 + x2 + x3 y ~ x1 + x2 + x3 + x4 y ~ X1 + x2 + x3 + x4 + x5 y ~ x1 + x2 + x3 + x4 + x5 + x6 , the correct form of the model as noted above y ~ X1 + x2 + x3 + x4 + x5 + x6 + x7 y ~ x1 + x2 + x3 + x4 + x5 + x6 + x7 + x8 y ~ x1 + x2 + x3 + x4 + x5 + x6 + x7 + x8 + x9 For each model, calculate Train and Test RMSE
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
