\Header{periodicSpline}{Create a Periodic Interpolation Spline}
\alias{periodicSpline.default}{periodicSpline}
\alias{periodicSpline.formula}{periodicSpline}
\keyword{models }{periodicSpline}
\begin{Usage}
\begin{verbatim}
periodicSpline(obj1, obj2, knots, period, ord)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\texttt{obj1}] Either a numeric vector of \texttt{x} values or a formula.
\item[\texttt{obj2}] If \texttt{obj1} is numeric this should be a numeric vector
of the same length.  If \texttt{obj1} is a formula this can be an
optional data frame in which to evaluate the names in the formula.
\item[\texttt{knots}] An optional numeric vector of knot positions.
\item[\texttt{period}] A positive numeric value giving the period for the
periodic spline.  Defaults to \texttt{2 * pi}.
\item[\texttt{ord}] A positive integer giving the order of the spline.  Defaults
to 4.  See \texttt{?splineOrder} for a definition of the order of a spline.
\end{ldescription}
\end{Arguments}
\begin{Description}
Create a periodic interpolation spline, either from \texttt{x} and
\texttt{y} vectors, or from a formula/data.frame combination.\end{Description}
\begin{Value}
An object that inherits from class \texttt{spline}. The object can be in
the B-spline representation, in which case it will be a
\texttt{pbSpline} object, or in the piecewise polynomial representation
(a \texttt{ppolySpline} object).\end{Value}
\begin{Author}
Douglas Bates and Bill Venables\end{Author}
\begin{SeeAlso}
\texttt{\Link{splineKnots}},
\texttt{\Link{interpSpline}},
\texttt{\Link{periodic.spline}}\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
xx <- seq( -pi, pi, len = 16 )
yy <- sin( xx )
frm <- data.frame( xx, yy )
pispl <- periodicSpline( xx, yy, period = 2 * pi )
pispl2 <- periodicSpline( yy ~ xx, data = frm, period = 2 * pi )
# pispl and pispl2 should be the same
plot( predict( pispl, seq(-3*pi, 3*pi, len = 101) ) )
plot( pispl )
\end{ExampleCode}
\end{Examples}

