[R] smoothing splines and degrees of freedom

i.m.s.white i.m.s.white at ed.ac.uk
Fri Jun 30 11:48:23 CEST 2006


I cannot vouch for the behaviour of the function smooth.spline(), but
the theoretical answer to your question is yes. If g = Sy is the transformation
from data vector y to spline vector g, the equivalent degrees of freedom are
usually defined as EDF = trace(S), where S is the n x n smoothing matrix:

EDF = sum_i(1/(1+theta*lambda_i)),

where lambda_1 to lambda_n are the eigenvalues of S. Two of these are zero, so

EDF = 2 + sum(1/(1+theta*lambda_i))

the sum now over i=3 to n. Here theta is the smoothing parameter. Setting
theta = 0 (no smoothing) gives EDF=n and produces the interpolating spline.
Setting theta = infty gives EDF=2 and a straight line fit. See either

Green and Silverman, Nonparametric regression and generalized linear models,
(p37), or
Hastie and Tibshirani, Generalized additive models, p52.

On Sat, Jun 24, 2006 at 11:35:16AM -0400, Steven Shechter wrote:
> Hi,
> If I set df=2 in my smooth.spline function, is that equivalent to running
> a linear regression through my data?  It appears that df=# of data points
> gives the interpolating spline and that df = 2 gives the linear
> regression, but I just want to confirm this.
> Thank you,
> Steven
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

*    I.White                                   *
*    University of Edinburgh                   *
*    Ashworth Laboratories, West Mains Road    *
*    Edinburgh EH9 3JT                         *
*    Fax: 0131 650 6564   Tel: 0131 650 5490   *
*    E-mail: i.m.s.white at ed.ac.uk              *

More information about the R-help mailing list