Tom Anderson said:
Jerry -
Thanks for the VBA examples. Too bad the documentation is not up to
standards - meaning no recognition (or little) about the algorithm sources
for each function - just the code to generate the chosen values. AND the
lack of the ROUND function in some VBA renditions - an easy enough thing to
code.
Many would appreciate credit where credit is due.
Tom Anderson
I'm very happy you've asked this question and only too happy to fill
you in on where the algorithms came from. The original work was done
by me from approx. 1992-1996.
The poisson pdf is mine. The poisson cdf continued fractions for the
tails of the poisson distribution are old and well known - I really
should find references to these. The gamma/poisson cdf asymptotic
expansion is mine I've recently published details of how it works in
sci.stat.math (The binomial pdf is mine. I developed the continued fraction for the
beta/binomial distributions myself although it may have been developed
by someone else (if so I'd love to hear about it). The beta/binomial
cdf asymptotic expansion is mine - I will publish details of how it
works soon. The calculations for the gamma and beta distributions for
small shape parameters simply rely on series expansions of exp(-x) for
the gamma and (1-x)^(b-1) for the beta prior to integration.
The hypergeometric pdf is mine as is the continued fraction formula
for the hypergeometric cdf. It's similar to the ones for the poisson
and binomial. Again if someone has developed this formula
independently I'd love to hear about it - in particular why no-one
else is using it, given that it is far superior to standard summation
techniques! Incidentally, the technique of using a continued fraction
formula to sum the tails and then conventional summation techniques to
sum the terms nearer the centre increases the performance both in
terms of speed and accuracy.
The algorithms for inverting the gamma and beta functions are mine.
Details of how they work can be found via the "limits" link. This
link also leads to details of how the poisson/binomial/hypergeometric
pdf functions are calculated.
I had my own inverse function for the normal but replaced it with
AS241 for speed reasons. I'm not a big fan of approximations functions
which require you to come up with an entirely different approximation
function if you want to alter the accuracy to which the approximation
holds. I find functions which rely on an accuracy value much more
appealing but I needed speed for inversion functions for someone else
and I don't think you can beat AS241 for the speed/accuracy
combination.
The "crit" functions were added so I could calculate Clopper-Pearson
confidence bounds for the hypergeometric distribution (again details
of how the bounds are calculated can be found via the "limits" link.)
The "crit" functions for other discrete distributions were added
mainly for consistency.
I think that covers all the function in Examples.xls and the only
references I'm missing are for the continued fraction formulae for the
tails of the poisson distribution. I will try and update the code with
this information in the near future.
Ian Smith