Answer the question step by step with output in R Studio Problem 1 uses robust regression to model crime rates in different states. Problem 2
Answer the question step by step with output in R Studio Problem 1 uses robust regression to model crime rates in different states. Problem 2 uses functions from the caret package to compare multiple linear regression and robust regression for prediction. Problem 3 uses functions from the caret package to revisit the cross-validation assessment of regression methods. Data: We will use: The crime2005 data set, which is in the smss package; and The Auto data set, which is in the ISLR package. Problem 1 - Model Crime Rates with Robust Regression use robust regression to model crime rates in different states (plus Washington, DC). **Data Set**: Use ```{r} data("crime2005") ``` to load the **`crime2005`** data set, which is in the **smss** package.
In this problem, will use functions from the **caret** package to apply Leave-One-Out Cross-Validation (LOOCV) of multiple linear regression and robust regression models.
*
Question
The below code:
* specifies use of Leave-One-Out Cross-Validation (LOOCV) for assessment by the argument `method = "LOOCV"` in the `trainControl` function; and
* assesses **20**-nearest neighbor regression model, modeling response `mpg` on predictors `weight` and `year`, with standardization specified by `preProcess = c("center", "scale")`.
```{r}
train_method_Auto = trainControl(method="LOOCV")
fit_caret_Auto_20NN <- train(mpg ~ weight + year,
data = Auto,
method = "knn",
trControl = train_method_Auto,
preProcess = c("center", "scale"), # for standardization of predictors
tuneGrid = expand.grid(k = 20))
```
Run the code and display the assessment measure results. Then, enter the value of $MAE_{LOOCV}$ below.
20-nearest-neighbors regression $MAE_{LOOCV}$ = ?
Question
Write code to apply **LOOCV**to calculate $MAE_{LOOCV}$ for assessment of the (non-robust) multiple linear regression model of response `mpg` on predictors `weight` and `year`.
Enter your R code below.
Question
Enter the value of $MAE_{LOOCV}$ for assessment of the (non-robust) multiple linear regression model below.
multiple linear regression $MAE_{LOOCV}$ =
Question 19
Write code to apply **LOOCV**to calculate $MAE_{LOOCV}$ for assessment of the robust regression models of response `mpg` on predictors `weight` and `year`.
Use the default options for `intercept` and `weights` and **add the argument `maxit = 100`** to ensure the iterations converge.
Enter your R code below.
Question 20
Enter the *minimum* value of $MAE_{LOOCV}$ for assessment of the robust regression models below.
robust regression *minimum* $MAE_{LOOCV}$ =
Question 21
Based on your LOOCV results, do *linear* or *nonlinear* methods seem to produce more accurate predictions of `mpg` from predictors `weight` and `year`? **Create and include** a plot that visually provides support for your conclusion.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
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