Hi All

This might not be the last post for a while as I have begun to start thinking about commencing to consider writing a proposal for a text book. And such a committed undertaking will occupy (and has occupied) most of my writing time. This post only exists because I having been trying to clarify my understanding of some basic statistical concepts.

The Central Limit Theorem (CLT) states that the average (or sum) of a collection of random variables from any distribution (with a defined first and second moment; i.e., this does not Cauchy distribution) will be normally distributed. Formally if be an independent, identically distributed set of random variables with PDF , where and and the mean and variance of , respectively then ~ Norm() as .

In practice the CLT is the justification for the use of the z- and t-tests. Basically I don’t have to care what the underlying distribution of some process as the average of its observably random variables will be Gaussian. While I use t-tests (or more commonly evidence tests ) for split (or AB) testings I have never been truly comfortable with the idea of the CLT. In particular I don’t doubt the various proofs that it works, however I have never seen any non-experimental process to show how fast it becomes true. For example the sum of 12 random uniform random variables makes a near perfect Gaussian and the sum of 12 log-normal random variables does not. This post shows a process to evaluating the convergence (information loss) of the CLT. The process is demonstrated with a set of exponentially distributed variables.

The process has two steps. The first step is to derive the distribution of the average of the observed random variables . The second step is to calculate the Kullback–Leibler divergence of the and a Gaussian as a function on . Note that here the math is tractable and so an analytic result is derived however both these integrals could be conducted numerically.

Step 1) Finding : Let be an independent, identically distributed set of exponentially distributed random variables ( ~ ). Let . The distribution of is ; i.e., each random variable is integrated out in turn into the sum.

To find it is, as usual, easiest to start by knowing the answer and work back wards; I got to answer in a ponderous and indirect path so I will spare you the details but it involved failing to sleep on an uncomfortable couch. Let ; thus . A small amount of algebra leads to .

The remaining integral is trivial (i.e., wolfram alpha can solve it for me… ok in this case it is just a straight substitution of variables but normally that is what trivial integral means). Thus . And one more “thus” leads to . Since is also of the form of the principle of induction shows this is always valid and all that I have to do is turn the “*k*“s to “*n*“s. I debated leaving that as an exercise to the reader but here it is .

Next since is a sum not an average it must be transformed to . Recall that for monotonic functions changes of variables are conducted using . So . For the sake of notation let ; .

That is the distribution of the average of *n* exponentially distributed random variables. I was slightly surprised to note that it is a Gamma distribution as I had not previously realized that a Gamma was sum of exponential distributions!

Step 2) Calculate the KL divergence between and a Gaussian with the same mean and variance:

The mean and variance of are and . The KL divergence between two distributions and is . So the KL divergence is the expected log-ratio of the two distributions with respect to the first. It can be thought of a a measure of the difference between the two distributions weighted by the relative importance of the first. It has few nice properties. First it is always positive unless the two distributions are the same at which point is is zero. It works for both continuous and discrete distributions. It commonly is used to measure information gained from one distribution to another (normally the gain going from the prior to the posterior). Thus here it can be thought of as the information lost by using the CLT Gaussian approximation. Thus here the KL divergence is .

This integral large but straight forward. The first step is to group all of the constant terms into one place; let . Thus the integral can be rewritten as the more manageable . Which can be parsed as , where all the expectations and variances are with respect to . Using the many known properties of the Gamma distribution all terms can be evaluated. Thus the KL divergence is , where is the digamma function (very similar to the harmonic series, i.e. ).

The final function is messy but it does give an objective measure of the difference between the true distribution of the average of observed exponential random variables and the CLT assumed Gaussian distribution. It is there for possible to use this method to check, directly!, if the *n* for a given problem is large enough to make the CLT valid.

Also as noted in the introduction while I chose to do this algebraically because it is raining you could do both sets of integrals numerical.

Cheers That is it for now.

P.S. Stay tuned for more text book developments!