Re: gamma random numbers ? [message #30730] |
Wed, 15 May 2002 15:43  |
Craig Markwardt
Messages: 1869 Registered: November 1996
|
Senior Member |
|
|
hkc@ariel.met.tamu.edu (hkc) writes:
> i tried to make a gamma random numbers generator with two variables,
> shape and scale parameters.
> my simple idea is to use a uniformly distributed random number
> generators in IDL.
> then the probability of each bins is set to be distribuited by gamma
> functions.
> it means that inside of each bins, data are distributed uniformly,
> but overall probability is distributed by gamma.
> do you think it is O.K.?
> please let me know if you have any ides for this.
> thanks
This is the second time you have asked the same question, but I made a
response the first time. I'll assume you missed it. Or, did this
response not help?
Craig Markwardt writes:
>
> I think you just multiply the deviate by the scale parameter, right?
>
> See beautiful on-line book here:
> http://www.itl.nist.gov/div898/handbook/eda/section3/eda366b .htm
I.e.,
r = randomu(seed, gamma=SHAPE)*SCALE
Craig
--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@cow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
|
|
|
Re: gamma random numbers ? [message #30814 is a reply to message #30730] |
Thu, 16 May 2002 08:30  |
Andrew Loughe
Messages: 9 Registered: October 1998
|
Junior Member |
|
|
I would add to Craig's response an assignment to "seed"
that looks something like this:
seed = long((systime(1) - long(systime(1))) * 1.e6)
> r = randomu(seed, gamma=SHAPE)*SCALE
--
Andrew Loughe =====================================================
NOAA/OAR/FSL/AD R/FS5 | email: Andrew.Loughe@noaa.gov
325 Broadway | wwweb: www-ad.fsl.noaa.gov/users/loughe
Boulder, CO 80305-3328 | phone: 303-497-6211 fax: 303-497-6301
|
|
|