The Law of Large Numbers (LLN) basically states that the average obtained from a large number of trials should be close to the expected value, and will tend to become closer as more trials are performed.
lln.ani() in the animation package provides us a
visualization method for the LLN. It plots the sample mean as the sample size grows to check
whether the sample mean approaches to the population mean. Here we make an animation with the
Chi-squared distribution as the population
library(animation) ani.options(interval = 0.3) lln.ani(FUN = function(n, mu) rchisq(n, df = mu), mu = 5, cex = 0.6)