commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Rivera <paulriver...@gmail.com>
Subject Re: [math] Gamma Distribution Algorithm
Date Thu, 29 Mar 2012 23:36:08 GMT
Thanks for all the info guys!

As Ted Dunning mentioned, the inverse cumulative function is specific to
GammaDistributionImpl (I'm actually using commons math 2.2).  What then is
the algorithm that GammaDistributionImpl.sample() uses?  The link
http://en.wikipedia.org/wiki/Inverse_transform_sampling from
AbstractRealDistribution is not specific to the GammaDistributionImpl
anymore.  Is there a paper that you guys are drawing from?  I've found the
following from RandomDataImpl.nextGamma():

For 0 < shape < 1:
Ahrens, J. H. and Dieter, U., *Computer methods for sampling from gamma,
beta, Poisson and binomial distributions.* Computing, 12, 223-246, 1974.

For shape >= 1:
Marsaglia and Tsang, *A Simple Method for Generating Gamma Variables.* ACM
Transactions on Mathematical Software, Volume 26 Issue 3, September, 2000.
Is it the same when I call sample() from GammaDistributionImpl?

Best Regards,
Paul

On Thu, Mar 29, 2012 at 10:41 PM, S├ębastien Brisard <
sebastien.brisard@m4x.org> wrote:

> Hi Mikkel,
> >
> > I have created MATH-774 https://issues.apache.org/jira/browse/MATH-774
> > and assigned it to myself. I will check if other of the implemented
> > methods in oacm.random are not used either and open new issues if that
> > is the case.
> >
> > Thanks for making us aware of this, Paul.
> >
> > Cheers, Mikkel.
> >
> while you are at it, you might also want to check whether
> inverseCumulativeProbability(double) is appropriately overriden when
> closed-form expressions exist for the specific distribution at hand. I
> remember having to correct uniform and triangular distributions, which
> were invoking the default implementation of
> inverseCumulativeProbability(double), and therefore using iterative
> solvers to basically solve a linear (quadratic) equation...
>
> Best regards,
> S├ębastien
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message