R - Smoothing spline

> Procedural Languages > R

1 - Function

This function will fit a smoothing spline.

smooth.spline

2 - Fitting wit a specific lambda

We can specify df rather than <math>\lambda</math>.

smooth.spline(x, y, df = 10)

It's like a polynomial of degree 10. It has about that complexity, but it's smoother. So the degrees of freedom are not all spent on 10 polynomial terms, rather spread out over the whole spectrum of the function, from smooth to rough.

Advertising

3 - Cross validation

The LOOC Cross validation is done automatically in the function smooth.spline if you don't specify lambda or the degrees of freedom.

smooth.spline(x, y)