[R] Smooth periodic splines

Duncan Murdoch murdoch at stats.uwo.ca
Fri Jan 16 12:59:39 CET 2009

cmr.Pent at gmail.com wrote:
> Hello group!
> Is there a package that allows to fit smooth *periodic* splines to
> data? I'm interested in a function which combines the functionality of
> smooth.spline and splines::periodicSpline.

I don't know one, but you could use the same technique that 
periodicSpline uses:  repeat a copy of the data to the left and right of 
the main copy (similarly replicating the knots if you want regression 
splines rather than smoothing splines), then fit to the augmented 
dataset.  I don't think it is guaranteed to be exactly periodic, but it 
will be very close.

There is also the "periodic" option to splinefun and you might be able 
to use it to construct a true periodic basis, but you'll have to work 
out some tricky details to get that right.

Duncan Murdoch

More information about the R-help mailing list