[R] loess and locpoly

Pawel Teisseyre pteisseyre at excite.com
Sun May 11 10:45:41 CEST 2008




Dear list,

I've got a question concerning difference between loess and locpoly. I have to use a plug-in method to chose a bandwith so I take locpoly method to fit a curve. 

My problem is:I know how to get predicted values in loess:

m=loess(y~x)

y_fitted=predict(m). 

But how to get the same in locpoly? I computed like this:

bw=dpill(x, y, blockmax = 5, divisor = 20,trim = 0.01, proptrun = 0.05, 

          gridsize = n, range(x), truncate = FALSE)

          m=locpoly(x, y, drv = 0, degree = 1, gridsize= n, bandwidth=bw, bwdisc = 25,

          range(x), binned = FALSE)

          fitfn <- approxfun(m$x, m$y)

          m_y <- fitfn(x)

but i'm not sure it is right?   



Thanks in advanced.



Pawel Teisseyre.



More information about the R-help mailing list