Function scottBandwidth

Uses Scott's Rule to select the bandwidth of the Gaussian kernel density estimator. This is 1.06 * min(stdev(data), interquartileRange(data) / 1.34) N ^^ -0.2. R must be a forward range of numeric types.

double scottBandwidth(R) (
  R data
)
if (isForwardRange!R && is(ElementType!R : double));

Examples

immutable bandwidth = scottBandwidth(data);
auto kernel = parametrize!normalPDF(0, bandwidth);
auto kde = KernelDensity1D(data, kernel);

References

Scott, D. W. (1992) Multivariate Density Estimation: Theory, Practice, and Visualization. Wiley.