Public
Edited
Jan 16, 2022
Insert cell
Insert cell
Insert cell
Insert cell
Inputs.table(dt.select(["dob", "age", "race", "gender"]), { rows: 5 })
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
samples_stats = samples.rollup({
mean: aq.op.mean("avg"),
stdev: aq.op.stdev("avg")
})
Insert cell
Insert cell
sampleHistogramNarrow = samples
.groupby({
bin: aq.bin("avg", { step: STEP_SIZE / 100 })
})
.count()
Insert cell
function dnorm(x, mean = 0, sd = 1) {
return (1 / sd) * dnorm_standard((x - mean) / sd);
}
Insert cell
function dnorm_standard(x) {
return (1 / Math.sqrt(2 * Math.PI)) * Math.exp(-0.5 * Math.pow(x, 2));
}
Insert cell
normal_curve = sampleHistogramNarrow
.orderby("bin")
.objects()
.map((d) => {
return {
bin: d.bin,
count:
dnorm(d.bin, samples_stats.get("mean"), samples_stats.get("stdev")) *
d3.max(sampleHistogram, (d) => d.count)
};
})
Insert cell
normal_curve[100]
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
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