Let be a sequence of iid random variables with
and
. Define
. Let
denote the cdf of
. Then, for any
,
,
that is, has a limiting standard normal distribution.
Note that from , 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
. For small
, we can still observe the characteristic of the exponential distribution: the density is right-skewed. But as
grows large, the distribution tends to be symmetrical!
shapiro.test() is also performed to check whether the sample mean follows the normal distribution.
</ani>
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."))