oopt = ani.options(interval = 0.01, nmax = 150)
lln.ani(pch = ".")
# chi-square distribution; population mean = df
lln.ani(function(n, mu) rchisq(n, df = mu), mu = 5, cex = 0.6)
# save the animation in HTML pages
ani.options(ani.height = 480, ani.width = 600, outdir = getwd(), nmax = 100,
interval = 0.1, title = "Demonstration of the Law of Large Numbers",
description = "The sample mean approaches to the population mean as
the sample size n grows.")
ani.start()
par(mar = c(3, 3, 1, 0.5), mgp = c(1.5, 0.5, 0))
lln.ani(cex = 0.6)
ani.stop()
ani.options(oopt)
Run the code above in your browser using DataLab