====== Central Limit Theorem ====== Let $X_{1}, X_{2}, \ldots$ be a sequence of iid random variables with $E(X_{i})=\mu$ and $0 This animation shows the distribution of the sample mean as the sample size $n$ grows. A normality test ''shapiro.test()'' is also performed to check whether the sample mean follows the normal distribution. ===== R code =====
library(animation)
saveHTML({
    ani.options(nmax = 100, interval = 0.1)
    par(mar = c(3, 3, 1, 0.5), mgp = c(1.5, 0.5, 0), tcl = -0.3)
    clt.ani(type = "h")
}, img.name = "clt_ani", htmlfile = "clt_ani.html", ani.height = 600, 
    ani.width = 600, outdir = getwd(), title = "Demonstration of the Central Limit Theorem", 
    description = c("This animation shows the distribution of the sample\nmean as the sample size grows."))