Answers to the exercises are available here.
If you obtained a different (correct) answer than those listed on the solutions page, please feel free to post your answer as a comment on that page.
We will be using the dataset
state.x77, which is part of the
state datasets available in
R. (Additional information about the dataset can be obtained by running
a. Load the
b. Convert the
state.x77 dataset to a dataframe.
c. Rename the
Life Exp variable to
HS Grad to
HS.Grad. (This avoids problems with referring to these variables when specifying a model.)
Suppose we wanted to enter all the variables in a first-order linear regression model with
Life Expectancy as the dependent variable. Fit this model.
Suppose we wanted to remove the
Area variables from the model in Exercise 2. Use the
update function to fit this model.
- Model basic and complex real world problem using linear regression
- Understand when models are performing poorly and correct it
- Design complex models for hierarchical data
- And much more
Let’s assume that we have settled on a model that has
Murder as predictors. Fit this model.
Add an interaction term to the model in Exercise 4 (3 different ways).
For this and the remaining exercises in this set we will use the model from Exercise 4.
Obtain 95% confidence intervals for the coefficients of the two predictor variables.
Predict the Life Expectancy for a state where 55% of the population are High School graduates, and the murder rate is 8 per 100,000.
Obtain a 98% confidence interval for the mean Life Expectancy in a state where 55% of the population are High School graduates, and the murder rate is 8 per 100,000.
Obtain a 98% confidence interval for the Life Expectancy of a person living in a state where 55% of the population are High School graduates, and the murder rate is 8 per 100,000.
Since our model only has two predictor variables, we can generate a 3D plot of our data and the fitted regression plane. Create this plot.