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.

1 2 3 |

`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 |

`order` |
order of the polynomial used for local polynomials. The
default value is |

`ridge` |
ridging parameter. The default value performs a slight
ridging (see "Details"). |

`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 |

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

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`

.

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

The same as for `lpepa`

.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 | ```
data(cars)
attach(cars)
plot(speed, dist, main = "data(cars) & lpRIDGE 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)
mtext("bandw = 5")
legend(5,120, c("ridge = 0", "default ridging"), col = 2:3, lty = 1)
detach()
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.