Shiny App Data Products

Random Distribution Generator

dustinm800

What is it?

The Random Distribution Generator, or (RDG), is an app that allows you to:

  1. Create random samples with 10 to 2000 samples.
  2. Select the distribution from which you want your samples randomly pulled.
  3. View the value of each sample in your generated random sample.
  4. See a histogram summarizing the distribution of the random values generated.
  5. Choose the color of your histogram.

Three Distribution Functions Available

Choose from three distributions:

  1. Normal (Gaussian) Distribution

    \(f(x|\mu,\sigma) = \frac{1}{\sigma\sqrt{2\pi}}e^{-\frac{(x-\mu)^2}{2\sigma^2}}\)

  2. Uniform Distribution

    \(f(x) = \begin{cases} \frac{1}{b-a}\enspace for\ x \in [a,b]\\ 0 \quad otherwise\\ \end{cases}\)

  3. Exponential Distribution

    \(f(x; \lambda) = \begin{cases} \lambda e^{-\lambda x}\ x \geq 0\\ 0 \enspace \quad x < 0\\ \end{cases}\)

How it works

Select the distribution from which you'd like your samples chosen, indicated how many samples you'd like generated, and identified the color of the bars in your graph. As you make your selections RDG automagically updates the histogram using code similar to the R code evaluated below. In this example, n=200 samples are chosen from a normal distribution and a histrogram is drawn with blue bars.

require(ggplot2)
n <- 200  #select a sample size
data_random <- rnorm(n, mean=0, sd=1)
hist(data_random, col="powderblue")

plot of chunk demo

Randomly Generated Dataset

Optionally view all of the randomly generated values under the Table tab. Future versions of RDG will offer exports in various formats of the randomly generated datasets.

Example output from our demonstration on the previous slide would be:

head(data_random, 35)
##  [1]  0.19420130 -0.85397411 -0.85298534  0.64433506 -2.18147368
##  [6] -0.02967379  0.71094491 -0.39574042  2.02335137  0.05972537
## [11]  0.05981262  0.92158934 -0.31689791 -0.63201955 -0.45924442
## [16] -0.19179784 -0.78203568  0.93566773  2.35975421 -1.00889515
## [21]  1.66963872 -0.20020843  0.48838485 -0.97528791 -0.44054351
## [26]  1.60766785  0.55866081  0.17833036  0.56076859  0.97156427
## [31]  1.63521601 -0.39329024 -0.76780633  0.50643411  1.08205479