Re: random numbers with gamma distribution [message #13343] |
Mon, 09 November 1998 00:00  |
Alejandro C. Frery
Messages: 2 Registered: March 1998
|
Junior Member |
|
|
In fact T. Osborn is right, IDL only generates gamma deviates with integer
shape parameter. This may be due to the fact that it is easier to compute
this kind of Gamma random variables, since they are the sum of independent
exponentially distributed ones, and these are generated by a simple
transformation of uniform random variables.
I'll soon post a program that generates outcomes from arbitrary Gamma
distributed random variables but, in the meantime, some references on this
topic are
@book{devro86,
author = {L. Devroye},
address = {New York},
publisher = {Springer-Verlag},
title = {Non-uniform random variate generation},
year = {1986}
}
@book{buseu92,
author = {Bustos, O. H. and A. C. Frery},
address = {Rio de Janeiro, RJ, Brazil},
publisher = {CNPq/IMPA},
series = {Monografias de Matem\'atica, 49},
title = {Simula\c{c}\~{a}o estoc\'{a}stica: teoria e algoritmos
(vers\~{a}o completa)},
year = {1992}
}
Alejandro
Alejandro C. Frery http://www.di.ufpe.br/~frery
UFPE-DI, CP 7851, 50732-970 Recife, PE - Brazil
Tel: +55-81-2718430 # 3324 Fax: +55-81-2718438
David Fanning escreveu na mensagem ...
> T.Osborn (f055@uea.ac.uk) writes:
>
>> I'm trying to generate a random series that has a gamma distribution,
using
>> the randomu() function with the gamma keyword. The online help says to
set
>> gamma to an integer > 0. WHY DOES IT HAVE TO BE AN INTEGER? The gamma
>> distribution is in fact defined for all gamma > 0, not just integers.
>> I want to set gamma=0.5, which currently fails as it converts it to the
>> integer 0, which is not > 0, and so it fails.
>>
>> Is this a bug, and is there any work-around?
>
> Which gamma function are you running? Certainly not IDL's
> GAMMA function which works perfectly well with non-integer
> values:
>
> IDL> print, gamma(0.5)
> % Compiled module: GAMMA.
> 1.77245
>
> Cheers,
>
> David
>
> ----------------------------------------------------------
> David Fanning, Ph.D.
> Fanning Software Consulting
> E-Mail: davidf@dfanning.com
> Phone: 970-221-0438, Toll-Free Book Orders: 1-888-461-0155
> Coyote's Guide to IDL Programming: http://www.dfanning.com/
>
> Note: A copy of this article was e-mailed to the original poster.
>
|
|
|