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. Thanks, Andrey
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
The "cc" and "cp" bases in package `mgcv' provide periodic splines, [e.g. gam(y~s(x,bs="cc"))], but this may not be exactly the functionality you want. best, Simon On Friday 16 January 2009 08:42, 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. > > Thanks, > Andrey > > ______________________________________________ > R-help at 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.--> Simon Wood, Mathematical Sciences, University of Bath, Bath, BA2 7AY UK > +44 1225 386603 www.maths.bath.ac.uk/~sw283