by Antonio Serrano
August, 2016
This presentation has been created as part of the peer assessment for the Coursera Developing Data Products course, offered by Johns Hopkins University through Coursera.org. The aim of the assignment is to ensure that the students are capable of using:
The Shiny app at hand draws random samples from 10 different famous probability distributions and plots the samples using base R functions. It is avalilable at:
https://antonioserrano.shinyapps.io/Famous_random_distributions_visualizer/
Source code for ui.R and server.R files are available on the GitHub repo:
https://github.com/AntonioSerrano/Developing-Data-Products-Assignment
Specifically, the app includes the following distributions:
The app has a slider panel on the left side. There you can select the sample size from 1 to 10,000 observations. Likewise, the parameters to be entered change according to the chosen distribution. You can modify those parameters as desired considering their space limitations.
Each time you chose a distibution, sample size, and specific values for its parameters, R performs its corresponding random generation function. For instance, if you select a normal distribution with a sample size of 10, mean equal to 0 and standard deviation equal to 1, the software does this in the background:
example <- rnorm(n = 10, mean = 0, sd = 1)
example
[1] -0.23574115 -0.24741820 0.14448209 -2.03515698 1.25714309
[6] -0.08851634 -0.79995274 -0.37269722 -2.49621182 -0.31411036
On the main panel at the right side you can select the type of output from the random distribution generated. In particular, you can visualize histograms, summary statistics, and raw data generated in table format.
## Plot (histogram)
hist(example,
breaks = 30)
## Summary statistics
summary(example)
Min. 1st Qu. Median Mean 3rd Qu. Max.
-2.4960 -0.6931 -0.2808 -0.5188 -0.1253 1.2570
Finally, both graphics and raw data from the random distributions can be downloaded by pressing the “Download Graphic” and “Download Sample” buttons respectively on the slider panel at the bottom.