Exercises
Practice the following exercises to revise the concepts learned thus far:
- By far, the best way to become comfortable and learn the ins and outs of applied regression analysis is to actually carry out regression analyses. To this end, you can use some of the many datasets that are included in R. To get a full listing of the datasets in the datasets package, execute the following code:
help(package="datasets")
- There are hundreds more datasets spread across the other several thousand R packages. Even better, load your own datasets, and attempt to model them.
- Examine and plot the
pressure
dataset, which describes the relationship between the vapor pressure of mercury and temperature. What assumption of linear regression does this violate? Attempt to model this using linear regression by usingtemperature
squared as a predictor, as shown in the following code:
lm(pressure ~ I(temperature^2), data=pressure)
- Compare the fit between the model that uses the non-squared
temperature
and...