Regression Exercise

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

Regression Exercise

Exercise 1
a. Load the state datasets.
b. Convert the state.x77 dataset to a dataframe.
c. Rename the Life Exp variable to Life.Exp, and HS Grad to HS.Grad. (This
avoids problems with referring to these variables when specifying a model.)

The dataset state.x77, is part of the state datasets available in R. (Additional


information about the dataset can be obtained by running help(state.x77).)

Solution to Exercise 1

Exercise 2
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.
Solution to Exercise 2

Exercise 3
Suppose we wanted to remove the Income, Illiteracy, and Area variables from
the model in Exercise 2. Use the update function to fit this model.

Exercise 4
Let's assume that we have settled on a model that has HS.Grad and Murder as
predictors. Fit this model.
Exercise 5
Add an interaction term to the model in Exercise 4 (3 different ways).

Exercise 6
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.

Exercise 7
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.

Exercise 8
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.

Exercise 9
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.

You might also like