Lab 04

Due: Tuesday 2020-11-10 at 5pm

Getting started

Packages

In this lab we will work with one package: faraway.

If you need to install this package, run the following code once in your Console:

install.packages("faraway")

If you’d like to run your code in the Console as well you’ll also need to load the packages there. To do so, run the following in the console.

library(faraway) 

Note that the packages are also loaded with the same commands in your R Markdown document.

Data

The data frame we will be working with today is called teengamb and it is in the faraway package. To load the data add the following to your .Rmd file:

data("teengamb")

To find out more about the dataset, type the following in your Console: ?teengamb. A question mark before the name of an object will always bring up its help file. This command must be ran in the Console.

Remember: The Console is at the bottom of your RStudio workspace. Things you type in the Console will not be in your final report. This is a good place to peek at data (try typing teengamb in the Console) and look at help files with the ?.

Exercises

  1. Examine the teengamb data. What are the variables? How many observations are there?

  2. Using the teengamb data, fit a model with gamble as the response and the other variables as predictors.

  3. Using the model fit in Exercise 2, check the constant variance assumption for the errors. Explain your result.

  4. Using the model fit in Exercise 2, check the normality assumption. Explain your result.

  5. Using the model fit in Exercise 2, check for large leverage points. Explain your result.

  6. Using the model fit in Exercise 2, check for outliers. Explain your result.

  7. Using the model fit in Exercise 2, check for influential points. Explain your result.

  8. Using the model fit in Exercise 2, predict the amount that a (future) male with average (given these data) status, income and verbal score would gamble along with an appropriate 95% CI.

  9. Using the model fit in Exercise 2, repeat the prediction for a (future) male with maximal values (for this data) of status, income and verbal score. Which CI is wider and why is this result expected?

  10. Fit a model with sqrt(gamble) as the response but with the same predictors as Exercise 2. Now predict the response and give a 95% prediction interval for the individual in Exercise 8. Take care to give your answer in the original units of the response.

  11. Repeat the prediction for the model in Exercise 10 for a (future) female with status = 20, income = 1, verbal = 10. Comment on the credibility of the result.