drasys.or.prob
Class GammaDistribution

java.lang.Object
  |
  +--drasys.or.prob.Distribution
        |
        +--drasys.or.prob.ContinuousDistribution
              |
              +--drasys.or.prob.GammaDistribution

public class GammaDistribution
extends ContinuousDistribution
implements ContinuousDistributionI, FunctionI

An implementation of the Gamma probability distribution.

References:

The Art of Computer Programming: Seminumerical Algorithms (Vol 2, 3rd Ed)
    Donald Ervin Knuth; Hardcover
Numerical Recipes in C : The Art of Scientific Computing
    William H. Press, et al / Hardcover / Published 1993
Probability and Statistics
    Morris H. Degroot / Hardcover / Published 1986
Mathematical Statistics With Applications
    Dennis D. Wackerly, et al / Hardcover / Published 1996

See Also:
Serialized Form

Constructor Summary
GammaDistribution()
           
GammaDistribution(double alpha, double beta)
           
GammaDistribution(double alpha, double beta, IntegrationI integration)
          The argument integration will be used to compute the cdf from the pdf.
GammaDistribution(double alpha, double beta, long seed)
           
 
Method Summary
 double alpha()
          Returns the value of the alpha parameter.
 double beta()
          Returns the value of the beta parameter.
 double cdf(double x)
          Computes the cdf by numerical integration using the pdf.
 boolean equals(java.lang.Object o)
           
 double function(double x)
           
 double getRandomScaler()
          Returns a random number from the gamma distribution.
 double mean()
          Returns the mean of the distribution.
 double pdf(double x)
          Returns the value of the probability distribution function at x;
 double probability(double x1, double x2)
          Computes the the probability that x will be between x1 and x2 by numerical integration using the pdf.
 void setParameters(double alpha, double beta)
          Sets the distribution parameters.
 void setParameters(double alpha, double beta, double coefficient)
          Sets the distribution parameters.
 double std()
          Returns the standard deviation of the distribution.
 java.lang.String toString()
           
 double variance()
          Returns the variance of the distribution.
 
Methods inherited from class drasys.or.prob.ContinuousDistribution
inverseCdf, probability
 
Methods inherited from class drasys.or.prob.Distribution
getRandomMatrix, getRandomNumberGenerator, getRandomVector, setElements, setElements, setRandomNumberGenerator, setSeed
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GammaDistribution

public GammaDistribution()

GammaDistribution

public GammaDistribution(double alpha,
                         double beta)

GammaDistribution

public GammaDistribution(double alpha,
                         double beta,
                         long seed)

GammaDistribution

public GammaDistribution(double alpha,
                         double beta,
                         IntegrationI integration)
The argument integration will be used to compute the cdf from the pdf.
Method Detail

function

public double function(double x)
Specified by:
function in interface FunctionI

setParameters

public void setParameters(double alpha,
                          double beta,
                          double coefficient)
Sets the distribution parameters. This method uses the coefficient argument in the pdf: '1/[gamma(alpha+1)*beta^(alpha+1)]'.
Throws:
InvalidArgumentError - if alpha <= -1.0 or beta <= 0.0.

setParameters

public void setParameters(double alpha,
                          double beta)
Sets the distribution parameters. This method uses the 'lnGamma' method in 'functions' to compute the coefficient in the pdf: '1/[gamma(alpha+1)*beta^(alpha+1)]'.
Throws:
InvalidArgumentError - if alpha <= 0.0 or beta <= 0.0.

alpha

public double alpha()
Returns the value of the alpha parameter.

beta

public double beta()
Returns the value of the beta parameter.

mean

public double mean()
Returns the mean of the distribution.

variance

public double variance()
Returns the variance of the distribution.

std

public double std()
Returns the standard deviation of the distribution.

getRandomScaler

public double getRandomScaler()
Returns a random number from the gamma distribution.
Overrides:
getRandomScaler in class ContinuousDistribution

pdf

public double pdf(double x)
Returns the value of the probability distribution function at x;
Throws:
InvalidArgumentError - if x < 0.0.

cdf

public double cdf(double x)
Computes the cdf by numerical integration using the pdf.
Throws:
StatError - if the integration fails.

probability

public double probability(double x1,
                          double x2)
Computes the the probability that x will be between x1 and x2 by numerical integration using the pdf.
Throws:
InvalidArgumentError - if x2 < x1 or x1 < 0.0.
StatError - if the integration fails.

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright(C)1997-2000 by DRA Systems all rights reserved. OpsResearch.com