Thanks for your reply. I know it is taken from there. But my question is that bandwidth is for density estimation purpose, not for regression purpose like in this "local linear kernel regression" case. The bandwidth in the code reads h=sqrt(hx*hy) where hx and hy are calculated the way in the book. This has no direct reference, right? However, this unjustified bandwidth works pretty well. It must have some theoretical ground, what is it? Thanks a lot.
03 Sep 2008
Yi Cao
Dear Badger Emily,
You are right. The optimal bandwidth was taken from the book
Bowman, A. W., and A. Azzalini, Applied Smoothing Techniques for Data Analysis, Oxford University Press, 1997.
On page 31 of the book, section 2.4.2 Normal optimal smoothing, it gives h = (4/3n)^1/5 sigma and sigma is given on the same page:
sigma = median{|y-mu|}/0.6745
HTH
Yi
02 Sep 2008
Badger Emily
Thank you for the excellent work. I have a quick question: how did you choose the optimal bandwidth? Page 31 in Bowman and Azzalini is about density fitting, right? But the result from your bandwidth is pretty good. Any theory on that? thanks again.
02 Sep 2008
Roderick Knuiman
Hi,
I just reworked your code just a little bit;
- include one more input argument for degree p;
- use polyfit3.m for the local fitting of the polynomial of degree p (with same weights)
And you get a local polynomial smoother of arbitrary degree p.
29 Aug 2008
Roderick Knuiman
Nice and quite useful. Thanks. A possible extension might be to incorporate any possible degree for the polynomial.