Boost logo

Boost Users :

Subject: Re: [Boost-users] [random] present library status and doc
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2010-02-01 11:59:09


AMDG

Marco Guazzone wrote:
> But for what regards Gamma distribution I would to point out that
> actually the code used to generate random Gamma variates cannot be
> used to generate variates for two-parameters Gamma distributions
> (e.g., http://en.wikipedia.org/wiki/Gamma_distribution or
> http://www.itl.nist.gov/div898/handbook/eda/section3/eda366b.htm).
>
> In principle this should be possible by means of the "scaling property":
> Gamma(shape,scale) ~ scale*Gamma(shape,1)
>
> This would simply translate into
> boost::mt19937 rng;
> boost::gamma_distribution<> gamma(shape); // 1-parameter Gamma distribution
> boost::variate_generator<boost::mt19937&, boost::gamma_distribution<>
>
>> rvg(rng, gamma);
>>
> double r = scale*rvg();
>
> However, when shape == 1 the implementation uses the fact that
> Gamma(1) ~ Exp(1).
> This is rigth when scale==1 but not when scale != 1 since the exact relation is
> Gamma(1,scale) ~ Exp(1/scale)
>
> It is possibile to fix this problem?
> Also, it seems that the C++0x is rethinking the way to model the Gamma
> distribution as a two parameter distribution (see Sec. 26.5.8.3.3
> [rand.dist.pois.gamma] at
> http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2009/n3000.pdf).
> Maybe it is the case that also Boost think about it, do you?
>

Please file a trac ticket.

In Christ,
Steven Watanabe


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