I’ve spoken about these two fundamentals of asymptotics previously here and here. But sometimes, you need a .gif to really drive the point home. I feel this is one of those times.

Firstly, I simulated a population of 100 000 observations from the random uniform distribution. This population looks nothing like a normal distribution and you can see that below.

Next, I took 500 samples from the data with varying sample sizes. I used n=5, 10, 20, 50, 100 and 500. I calculated the sample mean (x-bar) and the z score for each and I plotted their kernel densities using ggplot in R.

Here’s a .gif of what happens to the z score as the sample size increases: we can see that the distribution is pretty normal looking, even when the sample size is quite low. Notice that the distribution is centred on zero.

Here’s a .gif of what happens to the *sample mean* as n increases: we can see that the distribution collapses on the population mean (in this case µ=0.5).

For scale, here is a .gif of both frequencies as n gets large sitting on the same set of axes: the activity is quite different.

If you want to try this yourself, the script is here. Feel free to play around with different distributions and sample sizes, see what turns up.

## One thought on “Law of Large Numbers vs the Central Limit Theorem: in GIFs”