Earlier quoted context omitted.
No, it does show multiple sample means. Each landing spot is the sum (scaled average) of the n - 1 bernoulli rvs, where n is the number of bins. The issue is that n is small.
You are correct in pointing out this error of the parent comment (by SiVal). Each ball is indeed the sum of "n-1" bernoulli RVs, and the CLT does apply to these sums. As btilly points out elsewhere, to actually obtain the correct limit, you have to normalize the sum correctly. Because of the way the scaling is done in this graphic, as you increase the number of levels, it's in effect normalizing the sum by dividing b…
The Central Limit Theorem Visualized with D3
51–60 of 80 posts
Re: The Central Limit Theorem Visualized with D3
#52Earlier quoted context omitted.
Agreed, learned more, was wrong, deleted comment. Curious though—doesn't the CLT apply to this distribution too, technically? Isn't the binomial distribution being sampled and converging on a normal distribution, as per the CLT? Maybe some more explanation would enlighten us.
Yes, this is definitely a special case of CLT. For instance, see: https://en.wikipedia.org/wiki/De_Moivre%E2%80%93Laplace_theo...
Re: The Central Limit Theorem Visualized with D3
#53Earlier quoted context omitted.
You are correct in pointing out this error of the parent comment (by SiVal). Each ball is indeed the sum of "n-1" bernoulli RVs, and the CLT does apply to these sums. As btilly points out elsewhere, to actually obtain the correct limit, you have to normalize the sum correctly. Because of the way the scaling is done in this graphic, as you increase the number of levels, it's in effect normalizing the sum by dividing b…
If we're going to pick nits, it would illustrate the "Weak" LLN, not the Strong LLN. The Strong LLN still holds here, but you'd need to plot the sample paths to illustrate it.
The reason I posted is to defend the OP against some assertions that I felt were picking at details of what started out to be a simple and fun visualization. I wrote what I did about the LLN to supply some intuition to the person who created the visualization, in case they wanted to put these two results in perspective.
Re: The Central Limit Theorem Visualized with D3
#54This is not the Central Limit Theorem.
Really? I see a collection X1, X2, ..., XN of Bernoulli(0.5) variables and the demonstration that the distribution of their sum, normalized for variance, approaches the Gaussian distribution as N increases. Is that not a direct consequence of the CLT?
Re: The Central Limit Theorem Visualized with D3
#55Re: The Central Limit Theorem Visualized with D3
#56Re: The Central Limit Theorem Visualized with D3
#57"The Bean Machine, also known as the quincunx or Galton box, is a device invented by Sir Francis Galton[1] to demonstrate the central limit theorem, in particular that the normal distribution is approximate to the binomial distribution." - http://en.wikipedia.org/wiki/Bean_machine
Re: The Central Limit Theorem Visualized with D3
#58So, there's this thing called the cumulant-generating function. It's pretty much defined for any random variable X. If you want to get technical it is the logarithm of the Fourier transform of a probability density function f(x). You're on HN so you probably know the first two jargon words, "logarithm" and "Fourier transform". A "probability density" just means that f(x) dx is the probability for X to be in the interval (x, x + dx). The Fourier transform puts us into a "frequency space" indexed by some variable k, so we can write the CGF as some function c(k), or in other words:
c(k) = ln[ ∫ dx f(x) exp(i k x) ]
So for the "step left/right" variable which is -1 with probability 1/2 and +1 with probability 1/2, c(k) = ln[cos(k)]. (It can get a little messy when you ask what happens when cos(k) crosses 0 etc, but this function is infinitely-often differentiable on a disc centered at 0 which is all that we need.)It also turns out that since the sum of all the probability ∫ dx f(x) = 1, you can just evaluate this for k=0 as c(0) = ln[ 1 ] = 0. The cumulants are derivatives evaluated at k=0:
c'(0) = i E[X] = i μ (where μ is the "expectation")
c''(0) = - (E[X²] - E[X]²) = -σ² (where σ² is the "variance")
c'''(0) = -i E[(x - μ)³] = -i σ³ γ (where γ is the "skewness")
It is not very hard to prove that if I have a sum of two random variables X + Y = Z, then their CGFs add like cz(k) = cx(k) + cy(k). This is the Fundamental Awesomeness of Cumulants: cumulants are pseudo-linear; they're linear in independent random variables.It is also not hard to prove that if I have a scalar multiplication U = X / n, then cu(k) = cx(k / n). Combining these together, the mean M = (X1 + X2 + ... + Xn) / n of n identical and independent random variables looks like:
cm(k) = n c(k / n)
Now if you know calculus, you know the rest. Taylor-expand around k = 0 to find: cm(k) = i μ k − k²/2 * (σ²/n) − i k³/6 (σ³ γ / n²) + ...
We see a geometric attenuation in this series, we keep dividing new terms by n. If we drop terms from c'' on we get a constant, M = μ. That's boring, so we keep one more term, to find: cm(k) ~= i E[X] − (Var[X] / n) k² / 2
This is extra-good if f(x) is symmetric about the mean (so that the skewness vanishes), but it is also pretty good even if the distribution is skewed.We can now invert all of the steps to return back to a probability density: you exponentiate, so you get exp(i μ k) exp(- k² σ²/ 2 n), then you inverse-Fourier-transform, which transforms the exp(i μ x) into a frequency offset x → x − μ and which transforms the Gaussian into another Gaussian, so you get a Gaussian centered at x = μ.
In other words you get approximately a normal distribution with mean E[X] and variance Var[X] / n, with the error given by convolutions of higher-order terms, and the first correction disappearing when the distribution is symmetric about μ (or otherwise non-skew).
Re: The Central Limit Theorem Visualized with D3
#59No, that's just wrong. The context is some positive integer n and values of some n real valued random variables independent and identically distributed (i.i.d.).
If for some n do what the quote says, then are not guaranteed to get a Gaussian.
Moreover, if do what the quote says and take the limit as n goes to positive infinity, then, say, in the case the random variables have expectation that is finite and finite variance, will get just the common expectation of those random variables -- this is the law of large numbers, not the central limit theorem. That the distribution of the mean converges to the point with the expectation is the 'weak' law of large numbers. That the mean converges to the expectation with probability 1 is the strong law of large numbers.
For the central limit theorem, add up the n i.i.d. values and divide by the square root of n. Then under meager assumptions (e.g., i.i.d. and, for likely the strongest conditions known, the Lindeberg-Feller conditions), as n goes to infinity, the distribution of the result will converge to a Gaussian ('normal') distribution. Authors with the details include J. Neveu, L. Breiman, M. Loeve, and K. Chung.
It's essential to divide by the square root of n, not just n.
Re: The Central Limit Theorem Visualized with D3
#60This is not the Central Limit Theorem.
Really? I see a collection X1, X2, ..., XN of Bernoulli(0.5) variables and the demonstration that the distribution of their sum, normalized for variance, approaches the Gaussian distribution as N increases. Is that not a direct consequence of the CLT?
Exactly. But the page defines the CLT as referring to:
"the mean of a sufficiently large number of independent random variables ..."
So it talks about the mean and then illustrates the sum, just as you are, which is confusing. I spent several minutes puzzling about how the mean of variables between zero and 1 could be 5, for example.
Now, I suppose you will say, the distribution of the mean is just the distribution of the sum, normalized, and this ought to be obvious to anybody with half a brain, but if this page is meant to help people trying to learn this stuff understand it, it would be better if it was accurate and not directly confusing with its language.