Hello, I come from a non statistics background, but R is available to me, 

and I needed to test an implementation of smoothing spline that I have 

written in c++, so I would like to match the results with R (for my unit
tests).

 

I am following Smoothing Splines, D.G. Pollock (available online)

 
where we have a list of points (xi, yi), the yi points are random such that:
y_i = f(x_i) + e_i 
where e_i is normal with mean 0 and variance sigma_i^2 
There is a smoothing parameter lambda between 0 and 1.
 .when lambda is 0, smoothness is all that matters, and the fitting function
will be a straight line.
 .when lambda is 1, the result is the interpolating spline.
In my case, this parameter is an input.


The resulting function is the spline that minimizes the criteria in (62) in
the referenced paper.


I am trying to call smooth.spline in R with parameters that match my problem
above. 

 

So I tried this sequence of calls in R:
> x <- c(1.,5.,10., 15., 20., 25., 30., 35.)
> y <- c(-999.98099, -1001.61875, -1007.9, -1019.36875, -1036.4,
-1059.21875, -1087.9, -1122.36875)
> smooth.spline( x,y, w=NULL, spar=0.5, cv=TRUE, all.knots= TRUE )



I am unsure about spar being the smoothness parameter, about where to put
the standard errors of the points, and about the return of the smooth.spline
function:
Smoothing Parameter spar= 0.5 lambda= 0.006833112 
Equivalent Degrees of Freedom (Df): 3.221101 
Penalized Criterion: 66.27819 
PRESS: 56.13537 



Basically, what would make sense to me is the list of points by which the
resulting spline passes,
or the errors from the initial y_i, or the coefficients of the cubic
polynomials within the [x_i, x_i+1] intervals.


Also, how would I plot the smoothed spline and see the progression from
straight line to interpolating spline as I change the smoothing parameter?

 

Any help is appreciated,


Best regards,


        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to