KERNEL computes a kernel density estimation or regression. Kernel estimation is a semi-parametric method for approximating a probability distribution.
KERNEL (BANDWIDTH=<bandwidth>,RELBAND=<relative bandwidth>,IQR) <variable> ;
or
KERNEL (BANDWIDTH=<bandwidth>,RELBAND=<relative bandwidth>,IQR) <dependent variable> <independent variable> ;
Usage
When KERNEL is used with a single argument, a Gaussian kernel density of the variable is computed and stored in @DENSITY. You can display the result using a GRAPH command with the variable and @DENSITY as arguments.
When KERNEL is used with two arguments, a Gaussian kernel regression of the first variable on the second is computed; the smoothed values of the dependent variable are stored in @FIT.
The default bandwidth for both estimators is RELBAND=1, which uses Silverman's default bandwidth:
h = RELBAND*h0*.9*NOB**(-.2),
where h0 is the standard deviation of the independent variable for the default NOIQR option, and the minimum of the standard deviation and the interquartile range divided by 1.349 for IQR. When the number of observations is one, h=1 is used. For values of RELBAND < 1, the fit is closer to the data (less smooth), while values of RELBAND > 1 fit less closely to the data (more smooth).
Output
KERNEL produces no printed output. A series called @DENSITY is stored when there is one argument and @FIT is stored when there are two arguments.
BANDWIDTH= specifies the absolute value of the bandwidth.
RELBAND= specifies the bandwidth relative to h, the default bandwidth.
IQR/NOIQR specifies whether the interquartile range is to be used to compute the bandwidth.
Method
Given the observed data series x(i), i=1,...,N, the Kernel estimator f(x) of the density of x may be obtained using the following equation:

where K is the kernel function and h is a 'band width' or smoothing parameter TSP uses the Normal or Gaussian kernel and a method based on a Fast Fourier Transform to evaluate this density.
The Kernel regression of y conditional on x is computed using the following equation:

Neither estimator is very sensitive to the choice of kernel function, but both are sensitive to the choice of band width h. The options allow the user to control the bandwidth either in absolute size or in size relative to the variance or interquartile range (if IQR is used) of the series. The default value of h is given by

where h0 is the standard deviation of the x series. Silverman (1986) shows that this choice has good mean squared error properties.
Haerdle, W., Applied Nonparametric Regression, Cambridge: Cambridge University Press, 1990.
Silverman B. W., Density Estimation for Statistics and Data Analysis, London: Chapman and Hall, 1986.