For observed pairs , , the relationship between and can be defined generally as
where and . If we are unsure about the form of , our objective may be to estimate without making too many assumptions about its shape. In other words, we aim to “let the data speak for itself”.
Non-parametric approaches require only that be smooth and continuous. These assumptions are far less restrictive than those of alternative parametric approaches, thereby increasing the number of potential fits and providing additional flexibility. This makes non-parametric models particularly appealing when prior knowledge about ‘s functional form is limited.
Estimating the Regression Function
If multiple values of were observed at each , could be estimated by averaging the value of the response at each . However, since is often continuous, it can take on a wide range of values making this quite rare. Instead, a neighbourhood of is considered.
Define the neighbourhood around as for some bandwidth . Then, a simple non-parametric estimate of can be constructed as average of the ‘s corresponding to the within this neighbourhood. That is,
is the uniform kernel. This estimator, referred to as the Nadaraya-Watson estimator, can be generalized to any kernel function (see my previous blog bost). It is, however, convention to use kernel functions of degree (e.g. the Gaussian and Epanechnikov kernels).
Kernel and Bandwidth Selection
The implementation of a kernel estimator requires two choices:
- the kernel, , and
- the smoothing parameter, or bandwidth, .
Kernels are often selected based on their smoothness and compactness. We prefer a compact kernel as it ensures that only data local to the point of interest is considered. The optimal choice, under some standard assumptions, is the Epanechnikov kernel. This kernel has the advantages of some smoothness, compactness, and rapid computation.
The choice of bandwidth is critical to the performance of the estimator and far more important than the choice of kernel. If the smoothing parameter is too small, the estimator will be too rough; but if it is too large, we risk smoothing out important features of the function. In other words, choosing involves a significant bias-variance trade-off.
smooth curve, low variance, high bias
rough curve, high variance, low bias
The simplest way of selecting is to plot for a range of different and pick the one that looks best. The eye can always visualize additional smoothing, but it is not so easy to imagine what a less smooth fit might look like. For this reason, it is recommended that you choose the least smooth fit that does not show any implausible fluctuations.
Selecting the amount of smoothing using subjective methods requires time and effort. Automatic selection of can be done via cross-validation. The cross-validation criterion is
where indicates that point is left out of the fit. The basic idea is to leave out observation and estimate based on the other observations. is chosen to minimize this criterion.
True cross-validation is computationally expensive, so an approximation known as generalized cross-validation (GCV) is often used. GCV approximates CV and involves only one non-parametric fit for each value (compared to CV which requires fits at each ).
In order to approximate CV, it is important to note that kernel smooths are linear. That is,
where is an smoothing matrix. is analogous to the hat matrix in parametric linear models.
It can be shown that
where is the diagonal element of (hence is analogous to , the leverage of the observation). Using the smoothing matrix,
where is the trace of . In this sense, GCV is analogous to the influence matrix.
Automatic methods such as CV often work well but sometimes produce estimates that are clearly at odds with the amount of smoothing that contextual knowledge would suggest. It is therefore extremely important to exercise caution when using them and it is recommended that they be used as a starting point.