HOME

TheInfoList



OR:

In
statistics Statistics (from German language, German: ''wikt:Statistik#German, Statistik'', "description of a State (polity), state, a country") is the discipline that concerns the collection, organization, analysis, interpretation, and presentation of ...
, kernel regression is a
non-parametric Nonparametric statistics is the branch of statistics that is not based solely on parametrized families of probability distributions (common examples of parameters are the mean and variance). Nonparametric statistics is based on either being distri ...
technique to estimate the
conditional expectation In probability theory, the conditional expectation, conditional expected value, or conditional mean of a random variable is its expected value – the value it would take “on average” over an arbitrarily large number of occurrences – give ...
of a
random variable A random variable (also called random quantity, aleatory variable, or stochastic variable) is a mathematical formalization of a quantity or object which depends on random events. It is a mapping or a function from possible outcomes (e.g., the po ...
. The objective is to find a non-linear relation between a pair of random variables ''X'' and ''Y''. In any
nonparametric regression Nonparametric regression is a category of regression analysis in which the predictor does not take a predetermined form but is constructed according to information derived from the data. That is, no parametric form is assumed for the relationship ...
, the
conditional expectation In probability theory, the conditional expectation, conditional expected value, or conditional mean of a random variable is its expected value – the value it would take “on average” over an arbitrarily large number of occurrences – give ...
of a variable Y relative to a variable X may be written: : \operatorname(Y \mid 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 Kernel may refer to: Computing * Kernel (operating system), the central component of most operating systems * Kernel (image processing), a matrix used for image convolution * Compute kernel, in GPGPU programming * Kernel method, in machine learnin ...
as a weighting function. The Nadaraya–Watson estimator is: : \widehat_h(x)=\frac where K_h is a kernel with a bandwidth h.


Derivation

: \operatorname(Y \mid X=x) = \int y f(y\mid x) \, dy = \int y \frac \, dy Using the
kernel density estimation In statistics, kernel density estimation (KDE) is the application of kernel smoothing for probability density estimation, i.e., a non-parametric method to estimate the probability density function of a random variable based on ''kernels'' as w ...
for the joint distribution ''f''(''x'',''y'') and ''f''(''x'') with a kernel ''K'', : \hat(x,y) = \frac\sum_^n K_h(x-x_i) K_h(y-y_i), : \hat(x) = \frac \sum_^n K_h(x-x_i), we get : \begin \operatorname(Y \mid X=x) &= \int \frac \,dy,\\ pt&= \frac,\\ pt&= \frac, \end which is the Nadaraya–Watson estimator.


Priestley–Chao kernel estimator

: \widehat_(x) = h^ \sum_^n (x_i - x_) K\left(\frac\right) y_i where h is the bandwidth (or smoothing parameter).


Gasser–Müller kernel estimator

: \widehat_(x) = h^ \sum_^n \left int_^ K\left(\frac\right) \, du\righty_i where s_i = \frac.


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 R is a programming language for statistical computing and graphics supported by the R Core Team and the R Foundation for Statistical Computing. Created by statisticians Ross Ihaka and Robert Gentleman, R is used among data miners, bioinform ...
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. install.packages("np") library(np) # non parametric library data(cps71) attach(cps71) m <- npreg(logwage~age) plot(m, plot.errors.method="asymptotic", plot.errors.style="band", ylim=c(11, 15.2)) points(age, logwage, cex=.25)


Related

According to
David Salsburg David S. Salsburg (born 1931) is an author. His 2002 book ''The Lady Tasting Tea'', subtitled ''How Statistics Revolutionized Science in the Twentieth Century'', provides a layman's overview of important developments in the field of statistics in t ...
, the algorithms used in kernel regression were independently developed and used in
fuzzy system A fuzzy control system is a control system based on fuzzy logic—a mathematical system that analyzes analog input values in terms of logical variables that take on continuous values between 0 and 1, in contrast to classical or digital logic, ...
s: "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

*
GNU Octave GNU Octave is a high-level programming language primarily intended for scientific computing and numerical computation. Octave helps in solving linear and nonlinear problems numerically, and for performing other numerical experiments using a langu ...
mathematical program package * Julia
KernelEstimator.jl
*
MATLAB MATLAB (an abbreviation of "MATrix LABoratory") is a proprietary multi-paradigm programming language and numeric computing environment developed by MathWorks. MATLAB allows matrix manipulations, plotting of functions and data, implementation ...
: A free MATLAB toolbox with implementation of kernel regression, kernel density estimation, kernel estimation of hazard function and many others is available o
these pages
(this toolbox is a part of the book ). *
Python Python may refer to: Snakes * Pythonidae, a family of nonvenomous snakes found in Africa, Asia, and Australia ** ''Python'' (genus), a genus of Pythonidae found in Africa and Asia * Python (mythology), a mythical serpent Computing * Python (pro ...
: the KernelReg
/code> class for mixed data types in the
/code> sub-package (includes other kernel density related classes), the packag
kernel_regression
as an extension of
scikit-learn scikit-learn (formerly scikits.learn and also known as sklearn) is a free software machine learning library for the Python programming language. It features various classification, regression and clustering algorithms including support-vector ...
(inefficient memory-wise, useful only for small datasets) * R: the function npreg of the ''np'' package can perform kernel regression. * Stata
npregress


See also

*
Kernel smoother A kernel smoother is a statistical technique to estimate a real valued function f: \mathbb^p \to \mathbb as the weighted average of neighboring observed data. The weight is defined by the ''kernel'', such that closer points are given higher weights. ...
*
Local regression Local regression or local polynomial regression, also known as moving regression, is a generalization of the moving average and polynomial regression. Its most common methods, initially developed for scatterplot smoothing, are LOESS (locally es ...


References


Further reading

* * * * {{cite book , last=Simonoff , first=Jeffrey S. , title=Smoothing Methods in Statistics , publisher=Springer , year=1996 , isbn=0-387-94716-7 , url=https://books.google.com/books?id=dgHaBwAAQBAJ


External links


Scale-adaptive kernel regression
(with Matlab software).

(with
Microsoft Excel Microsoft Excel is a spreadsheet developed by Microsoft for Microsoft Windows, Windows, macOS, Android (operating system), Android and iOS. It features calculation or computation capabilities, graphing tools, pivot tables, and a macro (comp ...
).
An online kernel regression demonstration
Requires .NET 3.0 or later.
Kernel regression with automatic bandwidth selection
(with Python) Nonparametric regression Articles with example R code