Rudy
April 25, 2015
The Law of Large Numbers app is an interactive Shiny that let's you examine how the law of large numbers allows you to use samples means to estimate population means!
The app draws samples from a normal distribution, and demonstrates how the sample means grow closer to the true population mean with greater sample sizes.
Let's draw two samples, one of size 5, the other of size 100, from a normal distribution with \( \mu = 40 \) and \( \sigma = 10 \):
mu = 40; sigma = 10
means <- data.frame(
n = c(5, 100),
mean = mean(rnorm(c(5, 100), mu, sigma))
)
| n | mean |
|---|---|
| 5 | 39.40145 |
| 100 | 39.40145 |
You can find the app at:
https://theriver.shinyapps.io/law-of-large-numbers/
The source code is available on GitHub.