View License

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

» Watch video

Highlights from
Local Linear Kernel Regression

4.7 | 3 ratings Rate this file 36 Downloads (last 30 days) File Size: 2.44 KB File ID: #19564 Version: 1.0
image thumbnail

Local Linear Kernel Regression


Yi Cao (view profile)


12 Apr 2008 (Updated )

A function to provide local linear estimator of Gaussian kernel regression

| Watch this File

File Information

This is the local linear version of the kernel smoothing regression function:

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


Kernel Smoothing Regression inspired this file.

This file inspired Kernel Regression With Variable Window Width.

MATLAB release MATLAB 7.6 (R2008a)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (6)
05 Apr 2009 V. Poor

03 Sep 2008 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.

Comment only
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


Comment only
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

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.

Comment only
29 Aug 2008 Roderick Knuiman

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

Contact us