Steve Wenck
November 17, 2017
The law of large numbers can be a hard concept for new statistics students to comprehend. My Shiny app presents an interactive graphical demonstration of the concept.
## Prepare histogram plots of the normal and uniform distribution examples
par(mfrow=c(2,2))
hist(rnorm(10), main="Normal distribution of 10 obs", xlab="Normal 10 obs")
hist(rnorm(100000), main="Normal distribution of 100,000 obs", xlab="Normal 100,000 obs")
hist(runif(10), main="Uniform distribution of 10 obs", xlab="Uniform 10 obs")
hist(runif(100000), main="Uniform distribution of 100,000 obs", xlab="Uniform 100,000 obs")
The code above demonstrates the law of large numbers. Similarly, the app has four types of distributions (normal, uniform, log normal, & exponential) & observations range from 10 to 25,000. This code simulates what the app is doing - displaying histograms for varying number of observations for different distribtion types.
This simulates what the user will see in the app - as more observations are included in the distribution, the closer the distribution mimics the expected distribution.
To help students understand how the law of large numbers works, my application takes input from the user in terms of number of observations and type of distribution and then creates a histogram with the input. Users of the app can see how increasingt he number of observations makes the selected distribution type look more like the expected distribution. Thus demonstrating the law of large numbers.