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: regxest lregxestp regestp

Quantlet: regxestp
Description: computes the Nadaraya-Watson estimator for multivariate regression.


Usage: mh = regxestp(x {,h {,K} {,v} })
x n x (k+1) matrix, the data. In the first k columns the independent variables is contained and in the last column the dependent one.
h optional scalar, k x 1 vector or 1 x k vector, bandwidth. If not given, 20% of the range of x[,1:k] is used as default.
K optional string, kernel function on [-1,1] or Gaussian kernel "gau". If not given, the Quartic kernel "qua" is used as default.
v optional m x k matrix, values of the independent variable in which to compute the regression. If not given and k < 4, a grid of length 100 (k = 1), length 30 (k = 2) or length 8 (k = 3) is used. If k >= 4 then v is set to the (sorted) x.
mh n x (k+1) or m x (k+1) matrix, the first k columns contain the grid or the sorted x[,1:k], the last column contains the regression estimate on the values of the first k columns.


x = 2.*pi.*(uniform(200,2)-0.5)  ; independent variable
m = sum(cos(x),2)                ; true function
e = uniform(200)-0.5             ; error term
x = x~(m+e)
mh = regxestp(x,2)               ; estimate function
mh = setmask(mh,"surface","blue")
plot(x,mh)                       ; surface plot

The Nadaraya-Watson regression estimate (blue line) using
Quartic kernel and bandwidth h = 2 and the data are

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