edu.uah.math.distributions
Class GammaDistribution

java.lang.Object
  extended by edu.uah.math.distributions.Distribution
      extended by edu.uah.math.distributions.GammaDistribution
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
ChiSquareDistribution, ExponentialDistribution

public class GammaDistribution
extends Distribution
implements java.io.Serializable

This class models the gamma distribution with a specified shape parameter and scale parameter. This distribution governs the time of an event in the Poisson process.

Version:
August, 2003
Author:
Kyle Siegrist, Dawn Duehring
See Also:
Serialized Form

Field Summary
 
Fields inherited from class edu.uah.math.distributions.Distribution
CONTINUOUS, DISCRETE, MIXED
 
Constructor Summary
GammaDistribution()
          This default constructor creates a new gamma distribution with shape parameter 1 and scale parameter 1.
GammaDistribution(double k, double b)
          This general constructor creates a new gamma distribution with specified shape parameter and scale parameters.
 
Method Summary
 double getCDF(double x)
          This method computes the cumulative distribution function of the distribution.
 double getDensity(double x)
          This method computes the probability density function,
 double getMaxDensity()
          This method returns the maximum value of the density function.
 double getMean()
          This method returns the mean bk.
 double getMGF(double t)
          This method returns the moment generating function.
 double getMoment(double a, int n)
          This method returns the moment a specified order about a specified point.
 double getMoment(int n)
          This method returns the moment of order n.
 double getScale()
          This method returns the scale parameter.
 double getShape()
          This method returns the shape parameter.
 double getVariance()
          This method returns the variance kb2.
 void setParameters(double k, double b)
          This method sets the parameters and creates the default domain.
 void setScale(double b)
          This method sets the scale parameters.
 void setShape(double k)
          This method sets the shape parameter.
 double simulate()
          This method simulates a value from the distribution.
 java.lang.String toString()
          This method returns a string that gives the name of the distribution and the values of the parameters.
 
Methods inherited from class edu.uah.math.distributions.Distribution
getDomain, getFailureRate, getMedian, getPGF, getQuantile, getSD, getType, setDomain, setDomain
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GammaDistribution

public GammaDistribution(double k,
                         double b)
This general constructor creates a new gamma distribution with specified shape parameter and scale parameters.

Parameters:
k - the shape parameter
b - the scale parameter

GammaDistribution

public GammaDistribution()
This default constructor creates a new gamma distribution with shape parameter 1 and scale parameter 1.

Method Detail

setParameters

public void setParameters(double k,
                          double b)
This method sets the parameters and creates the default domain.

Parameters:
k - the shape parameter
b - the scale parameter

setShape

public void setShape(double k)
This method sets the shape parameter.

Parameters:
k - the shape parameter

getShape

public double getShape()
This method returns the shape parameter.

Returns:
the shape parameter

setScale

public void setScale(double b)
This method sets the scale parameters.

Parameters:
b - the scale parameter

getScale

public double getScale()
This method returns the scale parameter.

Returns:
the scale parameter

getDensity

public double getDensity(double x)
This method computes the probability density function,

Specified by:
getDensity in class Distribution
Parameters:
x - a number > 0
Returns:
the probability density at x

getMaxDensity

public double getMaxDensity()
This method returns the maximum value of the density function. If the shape parameter is < 1, the maximum value is ∞ at x = 0. If the shape parameter is ≥ 1, the maximum occurs at x = b(k &minus 1).

Overrides:
getMaxDensity in class Distribution
Returns:
the maximum value of the probability density function

getMean

public double getMean()
This method returns the mean bk.

Overrides:
getMean in class Distribution
Returns:
the mean of the distribution

getVariance

public double getVariance()
This method returns the variance kb2.

Overrides:
getVariance in class Distribution
Returns:
the variance of the distribution

getMoment

public double getMoment(int n)
This method returns the moment of order n.

Overrides:
getMoment in class Distribution
Parameters:
n - the order
Returns:
the moment of order n

getMoment

public double getMoment(double a,
                        int n)
This method returns the moment a specified order about a specified point.

Overrides:
getMoment in class Distribution
Parameters:
a - the center
n - the order
Returns:
the moment of order n about a

getMGF

public double getMGF(double t)
This method returns the moment generating function. This function is given by M(t) = (1 &minus bt)−k for t < 1/b.

Overrides:
getMGF in class Distribution
Parameters:
t - a number in the domain of the MGF
Returns:
the moment generating function at t

getCDF

public double getCDF(double x)
This method computes the cumulative distribution function of the distribution.

Overrides:
getCDF in class Distribution
Parameters:
x - a number in the domain of the distribution
Returns:
the cumulative probability at x

simulate

public double simulate()
This method simulates a value from the distribution. If shape parameter is an integer, this is done by simulating an arrival time in a Poisson proccess.

Overrides:
simulate in class Distribution
Returns:
a simulated value from the distribution

toString

public java.lang.String toString()
This method returns a string that gives the name of the distribution and the values of the parameters.

Overrides:
toString in class Distribution
Returns:
a string giving the name of the distribution and the values of the parameters