periodicSpline
Create a Periodic Interpolation Spline
Description
Create a periodic interpolation spline, either from x
and y
vectors, or from a formula/data.frame combination.
Usage
periodicSpline(obj1, obj2, knots, period = 2*pi, ord = 4L)
Arguments
obj1 | either a numeric vector of |
obj2 | if |
knots | optional numeric vector of knot positions. |
period | positive numeric value giving the period for the periodic spline. Defaults to |
ord | integer giving the order of the spline, at least 2. Defaults to 4. See |
Value
An object that inherits from class spline
. The object can be in the B-spline representation, in which case it will be a pbSpline
object, or in the piecewise polynomial representation (a ppolySpline
object).
Author(s)
Douglas Bates and Bill Venables
See Also
Examples
require(graphics); require(stats) xx <- seq( -pi, pi, length.out = 16 )[-1] yy <- sin( xx ) frm <- data.frame( xx, yy ) pispl <- periodicSpline( xx, yy, period = 2 * pi) pispl pispl2 <- periodicSpline( yy ~ xx, frm, period = 2 * pi ) stopifnot(all.equal(pispl, pispl2)) # pispl and pispl2 are the same plot( pispl ) # displays over one period points( yy ~ xx, col = "brown") plot( predict( pispl, seq(-3*pi, 3*pi, length.out = 101) ), type = "l" )
Copyright (©) 1999–2012 R Foundation for Statistical Computing.
Licensed under the GNU General Public License.