kde | R Documentation |
The bandwidth of each kernel is calculated using neighboring points. We then sample the density on a fixed grid and construct interpolating functions for the density and CDF.
kde(x, n = NA, bwfac = 1, bwmin = 1e-06, limits = c(NA, NA), ngrid = 256)
x |
Vector of samples for which to construct density. |
bwfac |
Bandwidth adjustment factor. Calculated bandwidths will be uniformly scaled by this factor. Higher values produce smoother estimates. |
bwmin |
Minimum allowable bandwidth for an individual kernel. |
limits |
Closed boundaries for the distribution ( |
ngrid |
Number of grid points to use for the interpolation function. Default is 256. |
npt |
Size of the neighborhood to use for estimating bandwidth. N data points on each side of the a point will be used in the estimate. Default is 1/20 the total size of the dataset. |
The bwmin
parameter allows a minimum allowable bandwidth to be set. It's
a good idea to set this to something like the smallest meaningful difference in
measurement values. When in doubt, the smallest reporting unit of the measurement
apparatus is a good choice. The default value is 1e-6, which is meant to be
effectively zero, while protecting against a divide-by-zero in the event that
the bandwidth calculation produces zero as a result.
TODO: Right now the quantile function is not an exact inverse of the CDF because there is no way to guarantee that the two spline functions interpolate the same way. Need to fix.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.