Create a smooth density estimate for some data:
Compute probabilities from the distribution:
Increase the bandwidth for smoother estimates:
Allow the bandwidth to vary adaptively with local density:
Identify features in data to aid in parametric model fitting:
The estimate suggests both the form and starting values for maximum likelihood estimation:
Use kernel density estimation in higher dimensions:
A four-dimensional kernel density estimate:
Sample from the distribution:
Explore properties of kernel density estimators using custom kernel functions:
Specify radial or product type kernels for multivariate estimates:
Estimate distribution functions:
The first few terms of the PDF and CDF:
Compute moments of the distribution:
Special moments:
General moments:
Moments can often be computed in closed form:
Compute a closed form expression for the variance with a symbolic adaptive bandwidth:
Quantile function:
Special quantile values:
Generate random numbers:
Compute probabilities and expectations:
Generating functions:
Estimate bivariate distribution functions:
Compute moments of a bivariate distribution:
Special moments:
General moments:
Generate random numbers:
Automatically select the bandwidth to use:
More data yields better approximations to the underlying distribution:
Explicitly specify the bandwidth to use:
Use bandwidths of

and

:
Larger bandwidths yield smoother estimates:
The bandwidth need not be numeric:
The PDF and CDF of the estimate:
Specify bandwidths in units of standard deviation:
Use bandwidths of

and

of the standard deviation:
Allow the bandwidth to vary adaptively with local density:
Vary the local sensitivity from

(none) to

(full):
Setting the sensitivity to
Automatic uses

where

is the dimension of the data:
The PDFs are equivalent:
Vary the initial bandwidth for an adaptive estimate:
Specify an initial bandwidth of

and

, respectively:
Use any of several automatic bandwidth selection methods:
Silverman's method is used by default:
The PDFs are equivalent:
In the multivariate case, the bandwidth is a symmetric positive definite

×

matrix:
Giving a scalar
h effectively uses
h IdentityMatrix[p]:
Specifying diagonal elements

effectively uses
DiagonalMatrix[d]:
Any

×

matrix that could be symmetric positive definite can be given:
By default, Silverman's method is used to independently select bandwidths in each dimension:
Any automated method can be used to independently select diagonal bandwidth elements:
Methods used to estimate the diagonal need not be the same:
Use adaptive, oversmoothed, and constant bandwidths in the respective dimensions:
Plot the univariate marginal PDFs:
Give a scalar value to use the same bandwidth in all dimensions:
To use nonzero off-diagonal elements, give a fully specified bandwidth matrix:
The bandwidth matrix controls the variance and orientation of individual kernels:
Scalar bandwidths:
Dimension-wise bandwidths:
Fully specified bandwidth matrices:
Some named bandwidth methods follow a rule-of-thumb approach:
Formulas for some named bandwidth methods:
The estimates are equivalent:
The method of least squares cross-validation:
The expectation of the PDF using a Gaussian kernel and bandwidth

:
The expectation of the PDF of the leave-one-out density estimator:
The bandwidth is found by minimizing the least squares cross-validation function over

:
The method of Sheather and Jones uses a plug-in estimator to solve for the bandwidth:
The Sheather and Jones estimator:
The estimates are equivalent:
Specify any one of several kernel functions:
Define the kernel function as a pure function:
By default, the Gaussian kernel is used:
This is equivalent to using the PDF of a
NormalDistribution
:
Shapes of some univariate kernel functions:
Specify any one of several kernel functions for multivariate data:
Shapes of some bivariate product kernels:
Choose between product and radial-type kernel functions for multivariate data:
Computation of a single biweight kernel in two dimensions:
The radial version:
Bandwidths have similar effect for both radial and product type kernels:
Scalar bandwidths stretch the kernel equally in each dimension:
Diagonal elements stretch the kernel independently along each axis:
Nonzero off-diagonal elements change the orientation:
The PDFs of the various kernel functions:
The efficiency of kernels under the assumption of normally distributed data:
The built-in kernel functions all have relatively high statistical efficiency: