aspline                package:akima                R Documentation

_U_n_i_v_a_r_i_a_t_e _A_k_i_m_a _i_n_t_e_r_p_o_l_a_t_i_o_n

_D_e_s_c_r_i_p_t_i_o_n:

     The function returns a list of points which smoothly interpolate
     given data points, similar to a curve drawn by hand.

_U_s_a_g_e:

       aspline(x, y=NULL, xout, n = 50, ties = mean, method="original", degree=3) 

_A_r_g_u_m_e_n_t_s:

    x, y: vectors giving the coordinates of the points to be
          interpolated.  Alternatively a single plotting structure can
          be specified: see 'xy.coords'.

    xout: an optional set of values specifying where interpolation is
          to take place.

       n: If 'xout' is not specified, interpolation takes place at 'n'
          equally spaced points spanning the interval ['min(x)',
          'max(x)'].

    ties: Handling of tied 'x' values.  Either a function with a single
          vector argument returning a single number result or the
          string '"ordered"'.

  method: either '"original"' method after Akima (1970) or '"improved"'
          method after Akima (1991)

  degree: if improved algorithm is selected: degree of the polynomials
          for the interpolating function

_D_e_t_a_i_l_s:

     The original algorithm is based on a piecewise function composed
     of a set of polynomials, each of degree three, at most, and
     applicable to successive interval of the given points. In this
     method, the slope of the curve is determined at each given point
     locally, and each polynomial representing a portion of the curve
     between a pair of given points is determined by the coordinates of
     and the slopes at the points.

_V_a_l_u_e:

     A list with components 'x' and 'y', containing 'n' coordinates
     which interpolate the given data points.

_R_e_f_e_r_e_n_c_e_s:

     Akima, H. (1970) A new method of interpolation and smooth curve
     fitting based on local procedures, J. ACM *17*(4), 589-602

     Akima, H. (1991) A Method of Univariate Interpolation that Has the
     Accuracy of a Third-degree Polynomial. ACM Transactions on
     Mathematical Software, *17*(3), 341-366.

_S_e_e _A_l_s_o:

     'approx', 'spline'

_E_x_a_m_p_l_e_s:

     ## regular spaced data
     x <- 1:10
     y <- c(rnorm(5), c(1,1,1,1,3))

     xnew <- seq(-1, 11, 0.1)
     plot(x, y, ylim=c(-3, 3), xlim=range(xnew))
     lines(spline(x, y, xmin=min(xnew), xmax=max(xnew), n=200), col="blue")

     lines(aspline(x, y, xnew), col="red")
     lines(aspline(x, y, xnew, method="improved"), col="black", lty="dotted")
     lines(aspline(x, y, xnew, method="improved", degree=10), col="green", lty="dashed")

     ## irregular spaced data
     x <- sort(runif(10, max=10))
     y <- c(rnorm(5), c(1,1,1,1,3))

     xnew <- seq(-1, 11, 0.1)
     plot(x, y, ylim=c(-3, 3), xlim=range(xnew))
     lines(spline(x, y, xmin=min(xnew), xmax=max(xnew), n=200), col="blue")

     lines(aspline(x, y, xnew), col="red")
     lines(aspline(x, y, xnew, method="improved"), col="black", lty="dotted")
     lines(aspline(x, y, xnew, method="improved", degree=10), col="green", lty="dashed")

     ## an example of Akima, 1991
     x <- c(-3, -2, -1, 0,  1,  2, 2.5, 3)
     y <- c( 0,  0,  0, 0, -1, -1, 0,   2)

     plot(x, y, ylim=c(-3, 3))
     lines(spline(x, y, n=200), col="blue")

     lines(aspline(x, y, n=200), col="red")
     lines(aspline(x, y, n=200, method="improved"), col="black", lty="dotted")
     lines(aspline(x, y, n=200, method="improved", degree=10), col="green", lty="dashed")

