HW15 Sleep Levels

advertisement
The data set sleeplevels contains the following variables:
Sleep: the number of hours of sleep for a randomly selected night
Humidity: the humidity in the room (measured in whatever units people use for humidity)
Temperature: The temperature of the room (measured in Fahrenheit)
Noise: The ambient noise (measured in decibels)
Age: The age of the person being measured
The goal is to be able to predict the amount of sleep a person will get based on the other variables
For each part below when it asks you to plot something (usually part a) discuss what you see in the plot.
When you plot residuals by variable (usually part b) show the plot for each of the four variables
1) Run a model predicting sleep based on the other variables
a. What in the residual plots suggests your model could be improved?
b. Plot the residuals against each variable to find which two variables have a bowtie shape
2) Run a new model predicting sleep adding a temperature*humidity interaction
a. What in the residual plots suggests your model could still be improved?
b. Plot the residuals against each variable to find which new variables have an interaction
3) Run a new model predicting sleep adding a noise*age interaction
a. What in the residual plot shows there is still a problem?
b. Plot the residuals against each variable to get hints about how to fix the problem
4) Run a new model with temperature*humidity but the other two variables (noise and age) have a
quadratic interaction (ab, a2, b2, a2b, ab2, a2b2)
a. The residual plots are looking better, but plot the residuals against each variable to get
hints as to how the model can be improved.
5) Based on part 4 find the term that is missing (a cubic term) and add it to the model
a. You should now see that all residual plots (even by each variable) all look good. Run the
summary and find there is exactly one term that is not significant which term?
6) Run the final model (without the term from part 5 - It should have an F-statistic of 6.819e+07)
a. Put in your paper the residual plot
b. Put in your paper the residual plots by each variable
c. Put in your paper the summary of the model
7) Explain super complicated interactions
a. Explain the effect of each of the four variables. To do so you will need to
i. create a prediction equation
ii. Set the interacting variable to a low value
iii. Plot the effect
iv. Increase the interacting variable until it is high
v. Add the lines for each level of the interacting variable
vi. Give a legend which has different colors for each level
You should have four plots which have a bunch of multicolored lines based on changing
levels for the interacting variable
b. For each plot include a sentence or two explaining what you see as the effect of the
variable.
Download