dguedo
Feb 27th, 2016
I developed an educational data product used to illustrate the Central limit theorem, by repeatedly taking the mean from a set of independent and identically distributed random variables and plotting the results. This application was developed for the Developing Data Products course.
Users of the application can manipulate the application three different ways by;
This applications was designed using Shiny, and bulit in R. As you manipulate the number of observations the histogram of sample means fluctuates, converging on a normal distribution as the number observations increase.
This is achieved by first finding the mean for a set of IID random variables, then repeating this process a number of times. The code below executes this algorithm, with inputs from the user.
# server.R
means <- data.frame(
x=sapply(1:input$n_simulations,
function(x)
{mean(rnorm(input$n_size))}))
The code on the previous slide, when plotted, would look similar to the histogram below.