Subscribe Bookmark RSS Feed

Generating Generalized Gamma Distribution using JMP scripts

asvp

Community Trekker

Joined:

Jun 23, 2011

All,

Is there a function that would allow generating random numbers

from a generalized gamma distribution? Scripting guide has

function random gamma for generating random numbers from

Gamma distribution but I don't see anything for generalized gamma

distribution.

Thanks for your help.

-ASVP

3 REPLIES
ms

Super User

Joined:

Jun 23, 2011

I don't think you can get random numbers for a three-parameter generalized gamma distribution using the builtin generators. If it's possible I would also like to know how to do it.

However, JMP 9  can get random numbers from R. See JSL example below.

// Function that returns random numbers from

// generalized gamma distribution generated

// by R package VGAM

rgengamma = Function( {n = 100, b = 1, d = 1, k = 1},

  R Init();

  R Submit( "

library(VGAM)

rggam <- rgengamma(100,1,2,3)

" );

  rggam = R Get( rggam );

  R Term();

  rggam

);

// Example of how touse the function to populate a

// data table with n=100 random numbers

dt = New Table( "Generalized Gamma", New Column( "Random" ) );

Column( dt, "Random" ) << setvalues( rgengamma( 100, 1, 2, 3 ) );

mattf

Community Trekker

Joined:

Jun 23, 2011

Hi:

MS gave us a clue.  From the R prompt:

>library(VGAM)

>rgengamma

and

>?rgengamma

reveals that the rgengamma returns a modified base R rgamma function

y = rgamma(n, k)

scale*y^(1/d)

In JMP, we can also use a modification of the basic "Random Gamma" function, e.g.

Current Data Table() << New Column( "JMP GenGamma",

     Formula( 1*Random Gamma( 1 )^(1/2) ) );

     Current Data Table() << Run Formulas;

(Of course, one will have to fiddle with the parameters to get a match)

Matching random number generators, anyone - perhaps by fixing seeds?

Best regards,

-Matt

Best

asvp

Community Trekker

Joined:

Jun 23, 2011

Thanks Matt and MS for showing a way to generate random numbers from

generalized gamma distribution.

Regards,

-ASVP