Keywords - Function groups - @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

Library: smoother
See also: lpregest sker locpol

Quantlet: lpregxest
Description: estimates a univariate regression function using local polynomial kernel regression with Quartic kernel.

Reference(s):

Usage: mh = lpregxest (x,h {,p {,v}})
Input:
x n x 2, the data. The first column contains the independent variable, the second one contains the dependent variable.
h scalar, bandwidth. If not given, the rule of thumb bandwidth computed by lpregrot is used.
p optional scalar, order of polynomial: p = 0: yields the Nadaraya-Watson estimator. p = 1: local linear (default). p = 2: local quadratic, which is the highest possible order.
v optional m x 1 vector, values of the independent variable on which to compute the regression. If not given, the (sorted) x matrix 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 and the second column contains the regression estimate on the values of the first column.

Note:

Example:
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)

Result:
The Nadaraya-Watson regression estimate (blue line) using
Quartic kernel and bandwidth h = 1 and the true
regression function (thin black line) are pictured.



Author: M. Mueller, 20020915
(C) MD*TECH Method and Data Technologies, 05.02.2006