Each point is one of 3000 men from the mid-Atlantic United States, with his yearly wage in thousands of dollars. The question of the chapter is how wage relates to age, to the calendar year and to education. A local linear fit estimates the average wage at each age, the quantity f(x) = E(wage | age = x) of the notes; its bandwidth h says how many years of neighbours each estimate borrows from. Make h small and the curve chases noise; make it large and it flattens into the least-squares line. Then switch to year and to education to see the other two panels of Figure 1.1, and restrict to one job class to see how the picture changes.
Data: the Wage data of the book (3000 rows; wage in thousands of dollars, rounded here to 4 decimals). The local linear fit at x minimises the sum of K((xi − x)/h)(yi − a − b(xi − x))2 over a and b, with a Gaussian kernel K, and reports a. Boxplots follow R: the box runs between Tukey's hinges, the whiskers reach the most extreme points within 1.5 box lengths, and points beyond are drawn individually; the diamond is the mean.
code/ch01_introduction.py (local_linear, ls_line, box_stats, Figure 1.1), and the labs ch01_lab.R and ch01_lab.py.