de.lmu.ifi.dbs.elki.data.synthetic.bymodel.distribution
Class GammaDistribution

java.lang.Object
  extended by de.lmu.ifi.dbs.elki.data.synthetic.bymodel.distribution.GammaDistribution
All Implemented Interfaces:
Distribution

public final class GammaDistribution
extends Object
implements Distribution

Simple generator for a Gamma Distribution


Field Summary
private  double k
          Alpha == k
private  Random random
          The random generator.
private  double theta
          Theta == 1 / Beta
 
Constructor Summary
GammaDistribution(double k, double theta, Random random)
          Constructor for Gamma distribution generator
 
Method Summary
 double explain(double val)
          Return the PDF of the generators distribution
 double generate()
          Generate a random value with the generators parameters.
 double getK()
           
 double getTheta()
           
static double pdf(double x, double k, double theta)
          Gamma distribution PDF (with 0.0 for x < 0)
 String toString()
          Simple toString explaining the distribution parameters.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

k

private final double k
Alpha == k


theta

private final double theta
Theta == 1 / Beta


random

private Random random
The random generator.

Constructor Detail

GammaDistribution

public GammaDistribution(double k,
                         double theta,
                         Random random)
Constructor for Gamma distribution generator

Parameters:
k - k, alpha aka. "shape" parameter
theta - Theta = 1.0/Beta aka. "scaling" parameter
random - Random generator
Method Detail

pdf

public static double pdf(double x,
                         double k,
                         double theta)
Gamma distribution PDF (with 0.0 for x < 0)

Parameters:
x - query value
k - Alpha
theta - Thetha = 1 / Beta
Returns:
probability density

explain

public double explain(double val)
Return the PDF of the generators distribution

Specified by:
explain in interface Distribution
Parameters:
val - existing value
Returns:
distribution density

generate

public double generate()
Generate a random value with the generators parameters. Along the lines of - J.H. Ahrens, U. Dieter (1974): Computer methods for sampling from gamma, beta, Poisson and binomial distributions, Computing 12, 223-246. - J.H. Ahrens, U. Dieter (1982): Generating gamma variates by a modified rejection technique, Communications of the ACM 25, 47-54.

Specified by:
generate in interface Distribution
Returns:
new generated value

toString

public String toString()
Simple toString explaining the distribution parameters. Used in producing a model description.

Specified by:
toString in interface Distribution
Overrides:
toString in class Object
Returns:
description

getK

public double getK()
Returns:
the value of k

getTheta

public double getTheta()
Returns:
the standard deviation

Release 0.4.0 (2011-09-20_1324)