How it works...

The algorithm works using penalized spline smoothing. Very detailed material on this package can be found in its official PDF documentation: http://matt-wand.utsacademics.info/SPmanu.pdf.

The intuition behind this technique is to find a set of knots and weights that can help in capturing the non-linear relationship. However, this is dangerous from an overfitting perspective, as more knots will produce more overfitting. Penalized splines attempt to mitigate the impact of overfitting, by intelligently penalizing the weights (not allowing them to be as big as they would be without intervention).

Get R Statistics Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.