X = rnorm(100)
Y = X^3 + rnorm(100)
localpoly.reg(X, Y, degree.pol = 0, kernel.type = "box", bandwidth = 0)
localpoly.reg(X, Y, degree.pol = 1, kernel.type = "box", bandwidth = 0)
##--
X = runif(100,-3,3)
Y = sin(1/2*pi*X) + rnorm(100,0,.5)
localpoly.reg(X, Y, degree.pol = 0, kernel.type = "gaussian", bandwidth = 0)
localpoly.reg(X, Y, degree.pol = 1, kernel.type = "gaussian", bandwidth = 0)Run the code above in your browser using DataLab