@data-ui/histogram
Version:
React + d3 library for creating histograms
18 lines (15 loc) • 474 B
JavaScript
;
exports.__esModule = true;
exports.default = kernelGaussian;
/* eslint no-magic-numbers: 0 */
/*
* Returns an Epanechnikov (parabolic) kernel function which takes a
* free smoothing parameter as input.
* code from https://gist.github.com/mbostock/4341954
* kernel info https://en.wikipedia.org/wiki/Kernel_(statistics)
*/
function kernelGaussian() {
return function (val) {
return 1 / Math.sqrt(2 * Math.PI) * Math.exp(-0.5 * (val * val));
};
}