Generating gamma distributed random variables

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Generating gamma distributed random variables

Grześ Andruszkiewicz
Hi,

Is the generation of gamma distributed random variables implemented in
QuantLib (e.g. the inverse cumulative function)? There is a
GammaDistribution class, but it might be only density...

 I can always use boost if the answer is negative.

Cheers,
Grzegorz

------------------------------------------------------------------------------
Free Next-Gen Firewall Hardware Offer
Buy your Sophos next-gen firewall before the end March 2013
and get the hardware for free! Learn more.
http://p.sf.net/sfu/sophos-d2d-feb
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev
Reply | Threaded
Open this post in threaded view
|

Re: Generating gamma distributed random variables

Peter Caspers-4
Hi,

there is an implementation of the gamma function and the incomplete
gamma function in ql (be careful, "incomplete gamma function" seems to
be defined differently at different places confusingly). With these it
is easy to compute your pdf and cdf. The inverse cdf seems not to be
available in ql. I implemented it using a numerical zero search. I am
not sure if there are better ways to do this ?

Peter

Am 07.02.2013 14:52, schrieb Grześ Andruszkiewicz:

> Hi,
>
> Is the generation of gamma distributed random variables implemented in
> QuantLib (e.g. the inverse cumulative function)? There is a
> GammaDistribution class, but it might be only density...
>
>   I can always use boost if the answer is negative.
>
> Cheers,
> Grzegorz
>
> ------------------------------------------------------------------------------
> Free Next-Gen Firewall Hardware Offer
> Buy your Sophos next-gen firewall before the end March 2013
> and get the hardware for free! Learn more.
> http://p.sf.net/sfu/sophos-d2d-feb
> _______________________________________________
> QuantLib-dev mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/quantlib-dev


------------------------------------------------------------------------------
Free Next-Gen Firewall Hardware Offer
Buy your Sophos next-gen firewall before the end March 2013
and get the hardware for free! Learn more.
http://p.sf.net/sfu/sophos-d2d-feb
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev
Reply | Threaded
Open this post in threaded view
|

Re: Generating gamma distributed random variables

Grześ Andruszkiewicz
Hi Peter,

It is implemented in boost, see e.g.
http://stackoverflow.com/questions/5499967/gamma-distributed-random-variables-in-c.
You would have to look at the boost code to get the actual details
though.

Cheers,
Grzegorz

On 7 February 2013 18:53, Peter Caspers <[hidden email]> wrote:

> Hi,
>
> there is an implementation of the gamma function and the incomplete gamma
> function in ql (be careful, "incomplete gamma function" seems to be defined
> differently at different places confusingly). With these it is easy to
> compute your pdf and cdf. The inverse cdf seems not to be available in ql. I
> implemented it using a numerical zero search. I am not sure if there are
> better ways to do this ?
>
> Peter
>
> Am 07.02.2013 14:52, schrieb Grześ Andruszkiewicz:
>>
>> Hi,
>>
>> Is the generation of gamma distributed random variables implemented in
>> QuantLib (e.g. the inverse cumulative function)? There is a
>> GammaDistribution class, but it might be only density...
>>
>>   I can always use boost if the answer is negative.
>>
>> Cheers,
>> Grzegorz
>>
>>
>> ------------------------------------------------------------------------------
>> Free Next-Gen Firewall Hardware Offer
>> Buy your Sophos next-gen firewall before the end March 2013
>> and get the hardware for free! Learn more.
>> http://p.sf.net/sfu/sophos-d2d-feb
>> _______________________________________________
>> QuantLib-dev mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/quantlib-dev
>
>

------------------------------------------------------------------------------
Free Next-Gen Firewall Hardware Offer
Buy your Sophos next-gen firewall before the end March 2013
and get the hardware for free! Learn more.
http://p.sf.net/sfu/sophos-d2d-feb
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev