Histogram of Sampling Distribution

X-axis is how many successes out of N random binary "rolls" or "coin-flips". We call these coin-flips Bernoulli trials and their distributions Bernoulli distributions.

Y-axis is number of samples out of times that give us the corresponding x value

When N gets too big (≥ 100), the plot will start grouping the x-axis into bins, as with a normal histogram.

The random variable we will call X follows a binomial distribution.

Probability of a single success:
Times we sample:

Regardless what distribution the random variable X follows, the demo illustrates the central limit theorem. The central limit theorem applies to situations where we are interested in the distribution of X, which is the sum (or mean) of other events, which in this demo are Bernoulli trials. The theorem states that as \( N \to \infty \), X more closely follows the normal distribution.

Runs with surprisingly excellent snappiness on Firefox 59 on my Macbook.

My first D3.js app. Also built with Ramda. Uses code by Mike Bostock, creator of D3.js, as a starting point. Sorry it's really rough and the code is hardly readable. Created by Jason Zhao on April 15, 2018