Public
Edited
Aug 6, 2024
1 star
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
mX = d3.mean(dataset.map(d => d.X))
Insert cell
stdX = d3.deviation(dataset.map(d => d.X))
Insert cell
Insert cell
Insert cell
Insert cell
function bootstrapSample(dataset) {
const bootstrapDataset = [];
const n = dataset.length;
for (let i = 0; i < n; i++) {
const randomIndex = Math.floor(Math.random() * n);
bootstrapDataset.push(dataset[randomIndex]);
}
return bootstrapDataset;
}
Insert cell
function kde(kernel, thresholds, data) {
return thresholds.map(t => ({
X: t,
Y: 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

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