Interactive Probability Distributions Gallery

An exploratory journey into the world of randomness...

Ilias Konsoulas
Developing Data Products Project

Description of Purpose

  • The main purpose of this small app is an educational one: To help the user understand the influence of various probability distribution parameters on the appearance and behavior of their corresponding pdf/pmf and cdf functions.

  • Apart from that, it demonstrates the connection between a scaled histogram (which sums up to 1) and the corresponding pdf for every distribution of the Gallery. This proves to younger students the very essence of any pdf as a probability density measure and it verifies the validity of R's random number generators.

  • Finally, this app features a numerical and a graphical probability calculator. Those extra components help the user to do some quick calculations and see graphically the implied mathematical connections between the two functions (pdf and cdf).

  • Project Files (ui.R, server.R, index.html, index.Rmd)
    You may review the files developed for this app and its associated documentation at
    the following github branch: Developing Data Products Project Files.
    Please use Chrome as your default browser for the link to work properly.

User Interaction (1 of 3)

  • On the sidebar Panel, the user may select one of the 12 probability distributions which comprise the Gallery. This is done using the following selection Box:


  • After the distribution of interest is selected, the user may alter the number of bins (cells) to be used for the histogram plot of an adjustable size population of random numbers generated from the selected distribution. The histogram is scaled to sum up to unity and agrees with the overlying pdf plot of the distribution in red color. This verifies the correctness of R's random number generators. Also, the accuracy of the histogram improves and almost coincides with the associated pdf as the number of generated random samples increases using the relevant slider.

User Interaction (2 of 3)

  • Next, a couple of slide bars are provided for the app visitor to play with each distribution's parameters. The shape and location of the associated pdf, cdf and histogram are instantly updated in a reactive manner. For the Normal (Gaussian) distribution the adjustable pdf parameters are the mean and standard deviation.

  • As an extra feature, this app includes a quick probability calculator. The user may select the bounds of the interval where the probability is to be computed. The Lower Bound (x1) is adjusted with the top slider and is depicted on both graphs on the right with a cyan vertical line. The Upper Bound (x2) of the interval is adjusted with the bottom slider and is depicted on both graphs on the right with a magenta vertical line. Probability calculations are updated reactively when any of the pdf/cdf parameters or interval bounds change by the user.

User Interaction (3 of 3)

  • On the top of the Main Panel the pdf of the selected distribution is plotted along with the associated histogram which again is computed reactively after any user input is received. We plot a scaled version of the classic histogram in order to agree scale-wise with the pdf. As expected, both plots almost coincide for all possible distributions and parameter values.

  • On the bottom of the Main Panel we plot the cdf of the selected distribution. On both plots the user can see and adjust the probability integration interval bounds using the sliders on the sidebar panel.

  • The mathematical properties of the cdf function are exploited in order to demonstrate geometrically the magnitude of the calculated probability as the length of the blue vertical line segment on the left portion of the cdf plot. Again, the size of the blue line segment is updated reactively to agree with the calculated probability value when the interval bounds or pdf/cdf parameters are altered by the user.

Enjoy your journey into the world of randomness using a non-random Shiny app !!!