

periodicSpline {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 combina-
     tion.

_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 for-
          mula.

    obj2: If `obj1' is numeric this should be a numeric vec-
          tor 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 defini-
          tion 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 poly-
     nomial 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

