[Spambayes] RE: Central Limit Theorem??!! :)

Tim Peters tim.one@comcast.net
Mon, 23 Sep 2002 12:30:45 -0400


[T. Alexander Popiel]
> In message:  <20020923154703.2C816F57F@cashew.wolfskeep.com>
>              "T. Alexander Popiel" <popiel@wolfskeep.com> writes:
>>
>>  (15)  M[1] = x[1],  M[k] = M[k-1] + ((x[k] - M[k-1]) / k)
>>  (16)  S[1] = 0,     S[k] = S[k-1] + ((x[k] - M[k-1]) * (x[k] - M[k]))
>>
>>  for a population x of size n, 2 <= k <= n, where
>>  sigma = sqrt(S[n]/(n-1)).

Note that n can be 1 too.  That's why S[1] starts out at 0.

> It just occured to me that I neglected to mention that Knuth's S and
> Gary Robinson's S are different; Gary Robinson seems to be using S to
> be standard deviation (listed as sigma, above).

Yes, but in addition Gary is using population sdev rather than sample sdev.
Getting that from the Knuth recurrence is just a matter of dividing by n
rather than n-1:

    sigma = sqrt(S[n]/n)

If the difference between n and n-1 really matters, though, the scheme is in
big trouble <wink>.  A minor advantage of using n here instead is that you
don't have special-case n=1 to avoid division by 0 when computing sigma.