Central Limit Theorem Simulations with CLT-Explorer

Anton Grishin
26 July 2015

With CLT-Explorer you can:

  • Take control over CLT simulations
  • Observe convergence of samples' means distribution on normal distribution
  • See that the mean of this distriution limits to the theoretical mean of the parent distribution and its variance decreases proportionally to the number of variates in the sample
  • Save the plots you like as high resolution PNG files
  • Use in-built Help

Shiny functionality used in the project:

  • reactive()
  • reactiveValues()
  • observeEvent()
  • IncludeHTML()
  • downloadHandler() to save plots as PNG
  • Delaying reactivity (Re-calculate button)
  • Tabbed interface
  • Conditional UI panels
  • Reactive text and curves overlays
  • Complex graphics

Example of code for a simple CLT-simulation

data <- runif(5000, -3,13)
avg_data <- vector(length = 5000L)
for(i in 1:5000){avg_data[[i]] <- mean(runif(40, -3, 13))}
hist(data, breaks=50, col='orange', border = 'grey50', ylim=c(0,300))
hist(avg_data, breaks=50, col='darkgreen', border = 'grey50', add=TRUE)

Histograms of the initial distribution vs. distribution of means

plot of chunk unnamed-chunk-2