Suvarna Garge (Editor)

Kernel regression

Updated on
Edit
Like
Comment
Share on FacebookTweet on TwitterShare on LinkedInShare on Reddit
Kernel regression

Kernel regression is a non-parametric technique in statistics to estimate the conditional expectation of a random variable. The objective is to find a non-linear relation between a pair of random variables X and Y.

Contents

In any nonparametric regression, the conditional expectation of a variable Y relative to a variable X may be written:

E ( Y | X ) = m ( X )

where m is an unknown function.

Nadaraya–Watson kernel regression

Nadaraya and Watson, both in 1964, proposed to estimate m as a locally weighted average, using a kernel as a weighting function. The Nadaraya–Watson estimator is:

m ^ h ( x ) = i = 1 n K h ( x x i ) y i i = 1 n K h ( x x i )

where K is a kernel with a bandwidth h . The denominator is a weighting term with sum 1.

Derivation

E ( Y | X = x ) = y f ( y | x ) d y = y f ( x , y ) f ( x ) d y

Using the kernel density estimation for the joint distribution f(x,y) and f(x) with a kernel K,

f ^ ( x , y ) = n 1 h 2 i = 1 n K ( x x i h ) K ( y y i h ) ,
f ^ ( x ) = n 1 h 1 i = 1 n K ( x x i h )

we obtain the Nadaraya–Watson estimator.

Priestley–Chao kernel estimator

m ^ P C ( x ) = h 1 i = 1 n ( x i x i 1 ) K ( x x i h ) y i

Gasser–Müller kernel estimator

m ^ G M ( x ) = h 1 i = 1 n [ s i 1 s i K ( x u h ) d u ] y i

where s i = x i 1 + x i 2

Example

This example is based upon Canadian cross-section wage data consisting of a random sample taken from the 1971 Canadian Census Public Use Tapes for male individuals having common education (grade 13). There are 205 observations in total.

The figure to the right shows the estimated regression function using a second order Gaussian kernel along with asymptotic variability bounds

Script for example

The following commands of the R programming language use the npreg() function to deliver optimal smoothing and to create the figure given above. These commands can be entered at the command prompt via cut and paste.

According to David Salsburg, the algorithms used in kernel regression were independently developed and used in fuzzy systems: "Coming up with almost exactly the same computer algorithm, fuzzy systems and kernel density-based regressions appear to have been developed completely independently of one another."

Statistical implementation

  • MATLAB A free MATLAB toolbox with implementation of kernel regression, kernel density estimation, kernel estimation of hazard function and many others is available on these pages (this toolbox is a part of the book ).
  • Stata kernreg2
  • R: the function npreg of the np package can perform kernel regression.
  • Python: the package kernel_regression as an extension of sklearn
  • GNU Octave mathematical program package:
  • References

    Kernel regression Wikipedia


    Similar Topics