Exponential functions, like those of the form \(f(x) = \lambda e^{-\lambda x}\), have a characteristic shape shown in this plot (here with \(\lambda = 0.2\)).
This function is obviously very different from the standard normal distribution, but the Central Limit Theorem says that if I calculate averages of samples drawn from such an exponential distribution, the distribution of averages will become a standard normal for a large enough sample of averages. Let’s see this in action!
To take 1000 random draws from an exponential function of the form described above, I can use the rexp function from the stats package in R with the rate argument set to 0.2.
expdraws <- rexp(1000, rate = .2)
To take 1000 averages of 40 draws each from the exponential distribution, I can use the replicate function (part of the apply family of functions) with otherwise similar code.
meandraws <- replicate(1000, mean(rexp(40, rate = .2)))
This histogram shows the distribution of the 1000 averages calculated from 40 draws each from the exponential distribution. Notice that these numbers are distributed very differently from the function the numbers were drawn from; this distribution is mound-shaped.
The mean of this distribution is shown at the solid yellow line. This is the average of the 1000 calculated averages of 40 draws from the exponential distribution and it has a value of 4.9844983. The theoretical mean of this distribution is \(1/\lambda = 1/0.2\), or 5. This is shown at the dashed aqua line. These numbers are very close, which is what the Central Limit Theorem tells us.
The theoretical variance of the exponential distribution here is also \(1/\lambda = 1/0.2\), or 5. The Central Limit Theorem says that the sample standard deviation is equal to \(\sigma / \sqrt{n}\) where \(\sigma\) is the standard deviation of the underlying distribution the sample was drawn from and \(n\) is the number of draws from the distributions, 40 in my case. Let’s see how these numbers compare.
The sample standard deviation for my simulation is
sd(meandraws)
## [1] 0.7813052
The theoretical standard deviation is
5/sqrt(40)
## [1] 0.7905694
These numbers are in agreement, just as indicated by the Central Limit Theorem.
The distribution of random draws from the original distribution looks as we expect, much like the function it was drawn from. It does not look like a standard normal distribution.
As we have already hinted at, the distribution of averages of draws from the original distribution does look like a standard normal distribution.
Here I have changed the y-axis from counts to density, and also plotted a standard normal distribution with the theoretical mean and standard deviation from the original exponential distribution (\(1/\lambda\)). The theoretical mean is also shown with the dashed aqua line. The distribution of averages (the histogram in this figure) agrees well with the theoretical curve and is approximately normal. This is true even though these numbers were originally drawn from a vastly different distribution, just what the Central Limit Theorem tells us.