Library: | smoother |
See also: | lpregest sker locpol |
Macro: | lpregxest | |
Description: | estimates a univariate regression function using local polynomial kernel regression with Quartic kernel. |
Fan and Marron (1994): Binning for local polynomials
Haerdle (1991): Smoothing Techniques
Usage: | y = lpregxest (x,h {,p {,v}}) | |
Input: | ||
x | n x 2, the data. In the first column the independent, in the second column the dependent variable. | |
h | scalar, bandwidth. If not given, the rule of thumb bandwidth computed by lpregrot is used. | |
p | integer, order of polynomial. If not given, p=1 (local linear) is used. p=0 yields the Nadaraya-Watson estimator. p=2 (local quadratic) is the highest possible order. | |
v | m x 1, values of the independent variable on which to compute the regression. If not given, x is used. | |
Output: | ||
mh | n x 2 or m x 2 matrix, the first column is the sorted first column of x or the sorted v, the second column contains the regression estimate on the values of the first column. |
library("smoother") library("plot") ; x = 4.*pi.*(uniform(200)-0.5) ; independent variable m = cos(x) ; true function e = uniform(200)-0.5 ; error term x = x~(m+e) ; mh = lpregxest(x,1) ; estimate function ; mh = setmask(mh, "line","blue") m = setmask(sort(x[,1]~m) , "line","black","thin") plot(x,mh,m)
The Nadaraya-Watson regession estimate (blue) using Quartic kernel and bandwidth h=1 and the true regression function (thin black) are pictured.
Library: | smoother |
See also: | lpregest sker locpol |