Public
Edited
May 9
Insert cell
Insert cell
Insert cell
Insert cell
thresholds = d3.ticks(...d3.nice(...d3.extent(data), 10), 40)
Insert cell
function kde(kernel, thresholds, data) {
return thresholds.map(t => [t, d3.mean(data, d => kernel(t - d))]);
}
Insert cell
function epanechnikov(bandwidth) {
return x => Math.abs(x /= bandwidth) <= 1 ? 0.75 * (1 - x * x) / bandwidth : 0;
}
Insert cell
density = kde(epanechnikov(bandwidth), thresholds, data)
Insert cell
data = FileAttachment("NGCWell.json").json()
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more