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.
Introduction script and output
Estimation script and output
Prediction script and output
Explanation script and output
Diagnostics script and output
Problems with the Predictors script and output
Problems with the Error script and output
Transformation script and output
Model Selection script and output
Shrinkage Methods script and output
Insurance Redlining - A Complete Example script and output
Missing Data script and output
Categorical Predictors script and output
One Factor Models script and output
Models with Several Factors script and output
Experiments with Blocks script and output