Question
Answer the question step by step with output in R Studio Below I attached the quiz based on .RMD file, may be that will be
Answer the question step by step with output in R Studio
Below I attached the quiz based on .RMD file, may be that will be helpful
Problem 1 uses robust regression to model crime rates in different states.
Data: Use:
- Thecrime2005data set, which is in thesmsspackage and
- TheAutodata set, which is in theISLRpackage.
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.
### Question 1
For the **`crime2005`** data, use (non-robust) multiple linear regression to model the crime rate per 10,000 people (`VI2`) as a function of the percentage of the population that live in metropolitan areas (`ME`) and the percentage of the population that live below the poverty line (`PO`).
Fill in the coefficient of `PO` to complete the fitted regression equation. *Enter the value to 4 decimal places.*
$\hat{VI2} = -56.8232 + 0.8155 \cdot ME + \texttt{__________} \cdot PO$
***
### Question 2
Plot the regression diagnostic plots for the model in the previous question. Which states (or other regions) appear to be outliers? Give the **names** of the states (you may refer to http://www.50states.com/abbreviations.htm), and **discuss visual observations** supporting your selection.
***
### Question 3
**Use a** *while* **loop** to perform iteratively reweighted least squares regression with Huber weights.
Enter your R code below.
**Code Answer**: ```{r}
```
***
### Question 4
Fill in the coefficient of `PO` to complete the equation for the linear model you found in the previous question, using Huber weights. *Round the value to 4 decimal places.*
$\hat{VI2} = -40.3927 + 0.6794 \cdot ME + \texttt{__________} \cdot PO$
**Hint**: It may be helpful to use `rlm()` to fit a model with Huber weights, and compare your result with your result from the previous question. The answers may be slightly different, but not very different. However, for this question, you should enter your results from the *while* loop.
```{r, echo=TRUE}
```
***
### Question 5
Use `rlm()` to fit a robust regression model with Tukey's bisquare weights.
Enter your R code below.
**Code Answer**: ```{r, echo=TRUE}
```
***
### Question 6 :
Fill in the coefficient of `PO` to complete the equation for the linear model you found in the previous question, using Tukey's bisquare weights. *Round the value to 4 decimal places.*
$\hat{VI2} = -31.2926 + 0.6114 \cdot ME + \texttt{__________} \cdot PO$
***
### Question 7 :
: The coefficient of `PO` in Tukey's model is (higher/about the same/lower) than in the unweighted linear regression model. This makes sense, because the outlier Washington, D.C. has an especially (high/low) percentage of people living below the poverty line, and its crime rate is (higher/about the same/lower) than would be expected based on a linear model.
**:
```{r}
```
***
### Question 8
Make a scatterplot of the weights from the Tukey's bisquare model (as a function of the index in the data set). For each point with a weight less than 0.8, label the point with the state abbreviation.
**Note:** The STATE column is a factor variable. For purposes of adding the labels, it may be helpful to convert it to a character variable.
**Graph Answer**: ```{r, fig.width=5, fig.height=4}
```
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