lpridge               package:lpridge               R Documentation

_L_o_c_a_l _p_o_l_y_n_o_m_i_a_l _r_e_g_r_e_s_s_i_o_n _f_i_t_t_i_n_g _w_i_t_h _r_i_d_g_i_n_g

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

     Fast and stable algorithm for nonparametric estimation of
     regression functions and their derivatives via local polynomials
     and local polynomial ridge regression with polynomial weight
     functions.

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

     lpridge(x, y, bandwidth, deriv=0, n.out=200, x.out=NULL,
             order = NULL, ridge = NULL, weight = "epa", mnew = 100,
             var = FALSE)

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

       x: vector of design points, not necessarily ordered.

       y: vector of observations of the same length as x.

bandwidth: bandwidth for nonparametric estimation.  Either a number or
          a vector of the same length as x.out. 

   deriv: order of derivative of the regression function to be
          estimated; default is 0.

   n.out: number of output design points at which to evaluate the
          estimator; defaults to 200.

   x.out: vector of output design points at which to evaluate the
          estimator;  By default, an equidistant grid of `n.out' points
          from `min(x)' to `max(x)'.

   order: order of the polynomial used for local polynomials. The
          default value is `deriv + 1'.

   ridge: ridging parameter.  The default value performs a slight
          ridging (see "Details").  `ridge = 0' leads to the local
          polynomial estimator without ridging.

  weight: kernel weight function.  The default value is weight = "epa"
          for Epanechnikov weights.  Other weights are "bi" for
          biweights (square of "epa") and "tri" for triweights (cube of
          "epa").  If weight is a vector, it is interpreted as vector
          of coefficients of the polynomial weight function.  Thus,
          weight = "epa" is equivalent to weight = c(1,0,-1).

    mnew: force to restart the algorithm after mnew updating steps. 
          The default value is mnew = 100.  For `mnew = 1' you get a
          numerically "super-stable" algorithm (see refernce SBE\&G
          below).

     var: logical flag: if TRUE, the variance of the estimator
          proportional to the residual variance is computed (see
          "Details" below).

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

     described in the reference SBE&G below.  Several parameters
     described there are fixed either in the fortran routine or in the
     R-function.  There, you find comments how to change them.

     In S&G, a bad finite sample behavior of local polynomials for
     random design was found, and ridging of the estimator was
     proposed.  In `lpridge()', we use a ridging matrix corresponding
     to the smoothness assumption ``The squared difference of the
     derivative of order deriv of the regression function at the point
     of estimation and the weighted mean of design points is bounded by
     the residual variance divided by the ridge parameter.''

     Thus, without any smoothness assumption, `ridge = 0' would be
     appropriate, and for a nearly constant derivative of order
     `deriv', a ridge parameter going to infinity behaves well.  For
     equidistant design, ridging influences the estimator only at the
     boundary.  Asymptotically, the influence of any non-increasing
     ridge parameter vanishes.

     So far, our experience with the choice of a ridging parameter is
     limited.  Therefore we have chosen a default value which performs
     a slight modification of the local polynomial estimator (with
     denotations h = `bandwidth', d = `deriv', and where n0 =
     `length(x)*mean(bandwidth)/diff(range(x))' is a mean number of
     observations in a smoothing interval):

           ridge = 5*sqrt(n0)*h^(2*d) / ((2*d+3)*(2*d+5)).

     For `var=TRUE', the variance of the estimator proportional to the
     residual variance is computed, i.e., the exact finite sample
     variance of the regression estimator is `var(est) = est.var *
     sigma^2'.

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

     a list including used parameters and estimator. 

       x: vector of ordered design points.

       y: vector of observations ordered according to x.

bandwidth: vector of bandwidths actually used for nonparametric
          estimation.

   deriv: order of derivative of the regression function estimated.

   x.out: vector of ordered output design points.

   order: order of the polynomial used for local polynomials.

   ridge: ridging parameter used.

  weight: vector of coefficients of the kernel weight function.

    mnew: force to restart the algorithm after mnew updating steps. 

     var: logical flag: whether the variance of the estimator was
          computed.

     est: estimator of the derivative of order deriv of the regression
          function.

 est.var: estimator of the variance of est (proportional to residual
          variance).

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

     The same as for `lpepa'.

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

     data(cars)
     attach(cars)
     plot(speed, dist, main = "data(cars)  &  lp-regression")

     myfit <- lpridge(speed,dist,bandw = 5, ridge=0)         # local polynomials
     lines(myfit$x.out,myfit$est,col=2)

     myridge <- lpridge(speed,dist,bandw = 5)                # local pol. ridge
     lines(myridge$x.out,myridge$est,col=3)
     detach()

