Boost logo

Boost Users :

From: John Maddock (john_at_[hidden])
Date: 2007-12-19 04:46:18


Christian Henning wrote:
> Hi there, the documention of the gamma distribution talks about two
> different forms. How can can generate the second one with shape=1 and
> scale=1? I know how to get the first form:
>
> boost::math::gamma_distribution<> dist( 1, 1 );
>
> I don't see how to get the second one?

Right, the distribution takes two parameters: shape and *scale*, so the
construction is always:

boost::math::gamma_distribution<> d(myshape, myscale);

If instead you have parameters shape and *rate* then it's constructed as:

boost::math::gamma_distribution<> d(myshape, 1/myrate);

Or as noted in the docs "Therefore to construct a Gamma Distribution from a
rate parameter, you should pass the reciprocal of the rate as the scale
parameter."

In other words the a rate parameter is simply the reciprocal of the scale,
and vice versa.

Any clearer?

HTH, John.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net