periodicSpline
Create a Periodic Interpolation Spline

Description

Creates a periodic interpolation spline.

Usage

periodicSpline(obj1, obj2, knots, period = 2 * pi, ord = 4)
## Default S3 method:
periodicSpline(obj1, obj2, knots, period = 2 * pi, ord = 4) 
## S3 method for class 'formula':
periodicSpline(obj1, obj2, knots, period = 2 * pi, ord = 4)

Arguments

obj1 a numeric vector or a formula with the form of "y~x".
obj2 a numeric vector with the same length as obj1, or an optional data frame to evaluate the terms when obj1 is a formula. When obj1 is a formula and obj2 is missing, the sys.parent(1) is used as evaluation parent frame.
knots a numeric vector. Used to design interpolation spline.
period an optional value specifying the period for a periodic interpolation spline.
ord a positive integer. Must be bigger than 2, and at most the number of knots of obj1.

Details

The elements of obj1 must be distinct in the function periodicSpline.default.
The range between the first value and the last value of obj1 should be in one period.
Value
returns a list object of class c("pbSpline", "bSpline", "spline") that contains four components:
See Also
interpSpline, splineDesign.
Examples
qtr <- c(1, 2, 3, 4)
sales <- c(101, 102, 113, 104)
# fit a smooth seasonal pattern to sales
pS <- periodicSpline(qtr, sales, period = 4)
# interpolate/extrapolate to new times
predict(pS, seq(3,7,by=1/4))
Package splines version 6.0.0-69
Package Index