File Exchange

image thumbnail

Local Linear Kernel Regression

version 1.0 (2.44 KB) by

A function to provide local linear estimator of Gaussian kernel regression

4.66667
3 Ratings

14 Downloads

Updated

View License

This is the local linear version of the kernel smoothing regression function: http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectId=19195&objectType=FILE

The local linear estimator improves the regression behaviour near the edges of the region over which the data have been collected.

Comments and Ratings (6)

V. Poor

Emily Badger

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.

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

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.

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.

Roderick Knuiman

Nice and quite useful. Thanks. A possible extension might be to incorporate any possible degree for the polynomial.

MATLAB Release
MATLAB 7.6 (R2008a)

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Win prizes and improve your MATLAB skills

Play today