R scripts for Linear Models with R, Second Edition

Here are all the R scripts from the book.

Here are the R scripts individually by chapter along with R output for verification. As base R and packages are updated, the output may occasionally change or fail to function as originally intended in the book. See the end of each output file to see what versions of R and packages were used.

  1. Introduction script and output

  2. Estimation script and output

  3. Inference script and output

  4. Prediction script and output

  5. Explanation script and output

  6. Diagnostics script and output

  7. Problems with the Predictors script and output

  8. Problems with the Error script and output

  9. Transformation script and output

  10. Model Selection script and output

  11. Shrinkage Methods script and output

  12. Insurance Redlining - A Complete Example script and output

  13. Missing Data script and output

  14. Categorical Predictors script and output

  15. One Factor Models script and output

  16. Models with Several Factors script and output

  17. Experiments with Blocks script and output