Library: | smoother |
See also: | lpregest lpregxest lpderest gasmregxb |
Quantlet: | gasmregx | |
Description: | calculates the Gasser-Mueller estimator using quartic kernel |
Usage: | out = gasmregx(data, h{, der{, x}}) | |
Input: | ||
data | n x 2 matrix containing the data | |
h | scalar, bandwidth | |
der | optional scalar, derivative to estimate, which can take the values 0 (default), 1, or 2. | |
x | optional m x 1 vector which indicates where to calculate the estimates, default is the first column of data | |
Output: | ||
out | m x 2 matrix containing the estimated regression function |
library("smoother") pts=30 b=0.8 randomize(12345) x=pi*((1:pts)/pts) x=x~(sin(x)+0.5*normal(pts)) est0=gasmregx(x,b,0,x[,1]) est1=gasmregx(x,b,1,x[,1]) di=createdisplay(1,2) xp=setmask(x,"fillcircle","small") est0p=setmask(est0,"line","thin") est1p=setmask(est1,"line","thin") show(di,1,1,xp,est0p) show(di,1,2,xp,est1p)
Display with estimates of the regression curve (first window) and its derivative (second window).