# lpepa

##### Local polynomial regression fitting with Epanechnikov weights

Fast and stable algorithm for nonparametric estimation of regression
functions and their derivatives via **l**ocal **p**olynomials with
**Epa**nechnikov weight function.

- Keywords
- smooth

##### Usage

```
lpepa(x, y, bandwidth, deriv = 0, n.out = 200, x.out = NULL,
order = deriv+1, mnew = 100, var = FALSE)
```

##### Arguments

- x
vector of design points, not necessarily ordered.

- y
vector of observations of the same length as

`x`

.- bandwidth
bandwidth(s) 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; defaults to

`deriv = 0`

.- n.out
number of output design points where the function has to be estimated. The default is

`n.out=200`

.- x.out
vector of output design points where the function has to be estimated. The default value is an equidistant grid of

`n.out`

points from min(x) to max(x).- order
integer, order of the polynomial used for local polynomials. Must be \(\le 10\) and defaults to

`order = deriv+1`

.- mnew
integer forcing to restart the algorithm after

`mnew`

updating steps. The default is`mnew = 100`

. For`mnew = 1`

you get a numerically “super-stable” algorithm (see reference SBE\&G below).- var
logical flag: if

`TRUE`

, the variance of the estimator proportional to the residual variance is computed (see details).

##### Details

More details are described in the first reference SBE\&G (1994)
below. In S\&G, a bad finite sample behaviour of local polynomials
for random designs was found.
For practical use, we therefore propose local polynomial regression
fitting with ridging, as implemented in the function
`lpridge`

. In `lpepa`

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

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`

.

##### Value

a list including used parameters and estimator.

vector of ordered design points.

vector of observations ordered according to x.

vector of bandwidths actually used for nonparametric estimation.

order of derivative of the regression function estimated.

vector of ordered output design points.

order of the polynomial used for local polynomials.

force to restart the algorithm after mnew updating steps.

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

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

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

##### References

See also http://www.unizh.ch/biostat/ under
`Manuscripts`

etc.

- Numerical stability and computational speed:

B. Seifert, M. Brockmann, J. Engel and T. Gasser (1994)
Fast algorithms for nonparametric curve estimation.
*J. Computational and Graphical Statistics* **3**, 192--213.

- Statistical properties:

Seifert, B. and Gasser, T. (1996)
Finite sample variance of local polynomials: Analysis and solutions.
*J. American Statistical Association* **91**(433), 267--275.

Seifert, B. and Gasser, T. (2000)
Data adaptive ridging in local polynomial
regression. *J. Computational and Graphical Statistics* **9**,
338--360.

Seifert, B. and Gasser, T. (1998)
Ridging Methods in Local Polynomial Regression.
in: S. Weisberg (ed), *Dimension Reduction, Computational Complexity,
and Information*, Vol.**30** of Computing Science \& Statistics,
Interface Foundation of North America, 467--476.

Seifert, B. and Gasser, T. (1998)
Local polynomial smoothing.
in: *Encyclopedia of Statistical Sciences*,
Update Vol.**2**, Wiley, 367--372.

Seifert, B., and Gasser, T. (1996)
Variance properties of local polynomials and ensuing
modifications. in: *Statistical Theory and Computational Aspects
of Smoothing*, W. H<e4>rdle, M. G. Schimek (eds), Physica, 50--127.

##### See Also

`lpridge`

, and also `lowess`

and
`loess`

which do local linear and quadratic regression
quite a bit differently.

##### Examples

```
# NOT RUN {
data(cars)
attach(cars)
epa.sd <- lpepa(speed,dist, bandw=5) # local polynomials
plot(speed, dist, main = "data(cars) & lp epanechnikov regression")
lines(epa.sd$x.out, epa.sd$est, col="red")
lines(lowess(speed,dist, f= .5), col="orange")
detach()
# }
```

*Documentation reproduced from package lpridge, version 1.0-8, License: GPL (>= 2)*