cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Try the Materials Informatics Toolkit, which is designed to easily handle SMILES data. This and other helpful add-ins are available in the JMP® Marketplace
Choose Language Hide Translation Bar
asvp
Level I

Generating Generalized Gamma Distribution using JMP scripts

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 3
ms
Super User (Alumni) ms
Super User (Alumni)

Generating Generalized Gamma Distribution using JMP scripts

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
Level V

Generating Generalized Gamma Distribution using JMP scripts

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
Level I

Generating Generalized Gamma Distribution using JMP scripts

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

generalized gamma distribution.

Regards,

-ASVP