Library: | smoother |
See also: | regxestp lpregxest lregestp |
Quantlet: | lregxestp | |
Description: | estimates a multivariate regression function using local polynomial kernel regression with Quartic kernel. |
Usage: | mh = lregxestp(x {,h {,K} {,v} }) | |
Input: | ||
x | n x (k+1), the data. In the first p columns the independent variables, in the last column the dependent variable. | |
h | scalar or k x 1 vector, bandwidth. If not given, 20% of the volume of x[,1:k] is used. | |
v | m x p, values of the independent variable on which to compute the regression. If not given, a grid of length 100 (k=1), length 30 (k=2) and length 8 (k=3) is used in case of k<4. When k>=4 then v is set to x. | |
Output: | ||
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 second column contains the regression estimate on the values of the first k columns. |
library("smoother") library("plot") ; 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 = lregxestp(x,2) ; estimate function mh = setmask(mh,"surface","blue") plot(x,mh) ; surface plot setgopt(plotdisplay,1,1,"title","ROTATE!")
The local linear regression estimate (blue) using Quartic kernel and bandwidth h=2 and the data are pictured.
Library: | smoother |
See also: | regxestp lpregxest lregestp |