/hastie-ElemStatLearn-figures

Recreating figures from the textbook The Elements of Statistical Learning (2nd edition) by Trevor Hastie, Robert Tibshirani, and Jerome Friedman.

Figures from the Elements of Statistical Learning

I try to recreate all figures from the textbook The Elements of Statistical Learning (2nd edition) by Trevor Hastie, Robert Tibshirani, and Jerome Friedman with R using mainly ggplot2 and mlr.

See https://web.stanford.edu/~hastie/ElemStatLearn/ where you can get a PDF of the book.

For some figures you can find the code in the accompanying R package ElemStatLearn, but for many examples/figures in the book it is not immediately clear (at least it is/was for me) how they were produced. I hope it becomes more accessible via the following notebooks (though you still have to read the book to know what is going on):

  1. Introduction
  2. Overview of Supervised Learning
  3. Linear Methods for Regression
  4. Boosting and Additive Trees

The notebooks depend on the following R packages:

install.packages(c("ElemStatLearn", "knitr", "ggplot2", "mlr", "directlabels", "ggforce", "gridExtra", "mvtnorm", "reshape2", "scales", "leaps"))
#library("mlr") # machine learning in R
#library("directlabels") # automatic label positioning in ggplot
#library("ggforce") # drawing circles in ggplot
#library("gridExtra") # arrange multiple plots
#library("leaps") # Regression Subset Selection

Links