Library: | smoother |
See also: | regestp lpregest lregxestp |
Macro: | lregestp | |
Description: | estimates a multivariate regression function using local polynomial kernel regression. The computation uses WARPing. |
Binning for local polynomials, Fan/Marron (1994)
WARPing method, W. Haerdle, "Smoothing Techniques with applications in S"
Usage: | mh = lregestp(x {,h {,K {,d}}}) | |
Input: | ||
x | n x (p+1), the data. In the first p columns the independent, in the last column the dependent variable. | |
h | scalar or p x 1 vector, bandwidth. If not given, 20% of the volume of x[,1:p] is used. | |
K | string, kernel function on [-1,1]^p. If not given, the product Quartic kernel "qua" is used. | |
d | scalar, discretization binwidth. d[i] must be smaller than h[i]. If not given, the minimum of h/3 and (max(x)-min(x))'/r, with r=100 for p=1, and r=(1000^(1/p)) for p>1 is used. | |
Output: | ||
mh | m x (p+1) matrix, the first p columns constitute a grid and the last column contains the regression estimate on that grid. |
library("smoother") library("plot") ; x = 4.*pi.*(uniform(400,2)-0.5) m = sum(cos(x),2) e = uniform(400)-0.5 x = x~(m+e) ; mh = regestp(x,2) mh = setmask(mh, "surface","blue") m = setmask(x[,1:2]~m,"black","cross","small") plot(mh,m) setgopt(plotdisplay,1,1,"title","ROTATE!")
The Local Linear regession estimate (blue) using Quartic kernel and bandwidth h=2 and the true regression function (thin black crosses) are pictured.
Library: | smoother |
See also: | regestp lpregest lregxestp |