Published
Edited
Mar 17, 2022
2 stars
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
trueProportions = d3.range(nFacts).map(() => d3.randomUniform(0, 100)())
Insert cell
estimatedProportions = trueProportions.flatMap((trueValue) => {
const getRandomGuess = d3.randomUniform(0, 100);
const getInformedGuess = d3.randomNormal(trueValue, informedVariance);
const getInformedGuessClamped = (d) =>
Math.max(Math.min(100, getInformedGuess(d)), 0);
const guess = () =>
Math.random() * 100 < percentInformed
? getInformedGuessClamped()
: getRandomGuess();

return d3
.range(nRespondents)
.map(() => ({ trueValue, estimatedValue: guess() }));
})
Insert cell
import {tweet} from "@mbostock/tweet"
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