The Transformed Gamma Distribution

The transformed gamma distribution can be used to model the time until an event occurs a specified number of times. For example, if a system has n-1 backups all with identical exponential distributions, then the time until the original system and all its backups have failed can be modeled using a gamma distribution. From this example, it is obvious that the exponential distribution is a special case of the gamma distribution.

The transformed gamma distribution has two shape parameters and a scale parameter. The probability density function is:

Probability density of the transformed gamma distribution.

The transformed gamma distribution defines a rich family of distributions. Special values of the parameters result in a variety of well-known distributions:

The transformed gamma distribution is implemented by the TransformedGammaDistribution class. It has one constructor that takes three arguments. The first and second are the two shape parameters. The third is the scale parameter.

The following constructs a transformed gamma distribution with shape parameters 4.2 and 3, and scale parameter 1:

C#
var trgamma1 = new TransformedGammaDistribution(4.2, 3.0, 1.0);

The TransformedGammaDistribution class has three specific properties, ShapeParameter1, ShapeParameter2, and ScaleParameter, which return the shape and scale parameters of the distribution.

TransformedGammaDistribution has one static (Shared in Visual Basic) method, Sample, which generates a random sample using a user-supplied uniform random number generator. It takes fourth parameters. The first argument is the random number generator. The second to fourth parameters are the two shape parameters and the scale parameter of the distribution.

C#
var random = new MersenneTwister();
double sample = TransformedGammaDistribution.Sample(random, 4.2, 3.0, 1.0);

The above example uses the MersenneTwister to generate uniform random numbers.

For details of the properties and methods common to all continuous distribution classes, see the topic on continuous distributions.