Density Rain

Illustrates the concept of a probability density function using a Beta distribution.

Drag your mouse to create the desired Beta distribution, then press T to “throw darts” and then D to “rain” the darts down onto the horizontal axis.

Scroll down below the applet for more background and details.

Details

The process of throwing darts (T) involves using data augmentation to sample value of \(X\), the Beta random variable of interest. Let \(Y\) be a uniform random variable conditional on the value of \(X\) taking on any value between 0 and the height of the density function. Throwing a dart uniformly within the area underneath the density function is equivalent to jointly sampling a point \((X,Y)\) from the joint probability distribution \(p(X,Y)\).

The process of raining darts (D) involves integrating over all possible values of \(Y\) for every value of \(X\), yielding a valid sample from the distribution of \(X\).

\[p(x) = \int p(x,y) dy\]

Acknowledgements

This applet makes use of the excellent d3js javascript library. Please see the GitHub site for details about licensing of other libraries that may have been used in the source code for this applet.

Licence

Creative Commons Attribution 4.0 International. License (CC BY 4.0). To view a copy of this license, visit http://creativecommons.org/licenses/by/4.0/ or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.