Go up to eighth-degree. The fits are getting somewhat better globally, but locally there are too many wiggles, especially near the beginning. Local Smoothing . Spline fits consist of pasting together low-degree polynomials. Cubic splines are cubic polynomials pasted together so that at the knots the curve has continuous second derivatives.
Natural splines fit straight lines outside the extreme knots.
The function ns will create the appropriate regression matrix. Try the splines on the Baseball data. Other approaches include smoothing splines , kernel smoothers and lowess or loess . See page 250 of the book for brief descriptions. A nice, fast algorithm is the super smoother .