periodicSpline            package:splines            R Documentation

_C_r_e_a_t_e _a _P_e_r_i_o_d_i_c _I_n_t_e_r_p_o_l_a_t_i_o_n _S_p_l_i_n_e

_D_e_s_c_r_i_p_t_i_o_n:

     Create a periodic interpolation spline, either from `x' and `y'
     vectors, or from a formula/data.frame combination.

_U_s_a_g_e:

     periodicSpline(obj1, obj2, knots, period, ord)

_A_r_g_u_m_e_n_t_s:

    obj1: Either a numeric vector of `x' values or a formula.

    obj2: If `obj1' is numeric this should be a numeric vector of the
          same length.  If `obj1' is a formula this can be an optional
          data frame in which to evaluate the names in the formula.

   knots: An optional numeric vector of knot positions.

  period: A positive numeric value giving the period for the periodic
          spline.  Defaults to `2 * pi'.

     ord: A positive integer giving the order of the spline.  Defaults
          to 4.  See `?splineOrder' for a definition of the order of a
          spline.

_V_a_l_u_e:

     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).

_A_u_t_h_o_r(_s):

     Douglas Bates and Bill Venables

_S_e_e _A_l_s_o:

     `splineKnots', `interpSpline'

_E_x_a_m_p_l_e_s:

     library( splines )
     xx <- seq( -pi, pi, len = 16 )[-1]
     yy <- sin( xx )
     frm <- data.frame( xx, yy )
     print( pispl <- periodicSpline( xx, yy, period = 2 * pi ) )
     print( pispl2 <- periodicSpline( yy ~ xx, frm, period = 2 * pi ) )
     # pispl and pispl2 should be the same
     plot( predict( pispl, seq(-3*pi, 3*pi, len = 101) ), type = "l" )
     plot( pispl )          # displays over one period

