Table of Contents

Central Limit Theorem

Let \normalsize X_{1}, X_{2}, \ldots be a sequence of iid random variables with \normalsize E(X_{i})=\mu and \normalsize 0<Var(X_i)=\sigma^2<\infty. Define \normalsize \bar{X}_n=(1/n)\sum_{i=1}^n X_i. Let \normalsize G_n(x) denote the cdf of \normalsize \sqrt{n}(\bar{X}_n-\mu)/\sigma. Then, for any \normalsize x, \normalsize -\infty<x<\infty,

\lim_{n\rightarrow\infty}G_n(x)=\int_{-\infty}^x \frac{1}{\sqrt{2\pi}}e^{-y^2/2}dy

that is, \normalsize \sqrt{n}(\bar{X}_n-\mu)/\sigma has a limiting standard normal distribution.

Animation

Note that from \normalsize n \geq 15, the P-value becomes large, which indicates that we cannot reject the null hypothesis (the normality of the sample mean). The population distribution of the random variables is exponential distribution \normalsize \mathbf{Exp}(1). For small \normalsize n, we can still observe the characteristic of the exponential distribution: the density is right-skewed. But as \normalsize n grows large, the distribution tends to be symmetrical!

This animation shows the distribution of the sample mean as the sample size \normalsize n grows. A normality test shapiro.test() is also performed to check whether the sample mean follows the normal distribution. </ani>

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."))