• java.lang.Object
• All Implemented Interfaces:
ProbabilityDistribution<Double>

public class GammaDistribution
extends Object
implements ProbabilityDistribution<Double>
The Gamma distribution is a continuous probability distribution with cdf \begin{align*} F(x)=\frac{\gamma\left(k, \frac{x}{\theta}\right)}{\Gamma(k)} \end{align*} and pdf \begin{align*} f(x)=\frac{x^{k-1}e^{-\frac{x}{\theta}}}{\Gamma{k}\theta^k} \end{align*} where $k$ is the shape parameter and $\theta$ is the scale parameter.

• ### Constructor Summary

Constructors
Constructor Description
GammaDistribution​(double k, double theta)
GammaDistribution​(double k, double theta, RandomEngine engine)
• ### Method Summary

All Methods
Modifier and Type Method Description
boolean equals​(Object obj)
double getCDF​(Double x)
Returns the cumulative distribution function for a value
double getInverseCDF​(Double p)
Given a probability, return the value that returns this cdf
double getK()
double getPDF​(Double x)
Return the probability density function for a value
double getTheta()
int hashCode()
double nextRandom()
• ### Methods inherited from class java.lang.Object

clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
• ### Constructor Detail

public GammaDistribution​(double k,
double theta)
Parameters:
k - The shape parameter of the distribution, not negative or zero
theta - The scale parameter of the distribution, not negative or zero

public GammaDistribution​(double k,
double theta,
RandomEngine engine)
Parameters:
k - The shape parameter of the distribution, not negative or zero
theta - The scale parameter of the distribution, not negative or zero
engine - A uniform random number generator, not null
• ### Method Detail

• #### getCDF

public double getCDF​(Double x)
Returns the cumulative distribution function for a value
Specified by:
getCDF in interface ProbabilityDistribution<Double>
Parameters:
x - The value, not null
Returns:
The cdf
• #### getInverseCDF

public double getInverseCDF​(Double p)
Given a probability, return the value that returns this cdf
Specified by:
getInverseCDF in interface ProbabilityDistribution<Double>
Parameters:
p - The probability, not null. $0 \geq p \geq 1$
Returns:
Not supported
Throws:
UnsupportedOperationException - always
• #### getPDF

public double getPDF​(Double x)
Return the probability density function for a value
Specified by:
getPDF in interface ProbabilityDistribution<Double>
Parameters:
x - The value, not null
Returns:
The pdf
• #### nextRandom

public double nextRandom()
Specified by:
nextRandom in interface ProbabilityDistribution<Double>
Returns:
The next random number from this distribution
• #### getK

public double getK()
Returns:
The shape parameter
• #### getTheta

public double getTheta()
Returns:
The location parameter
• #### hashCode

public int hashCode()
Overrides:
hashCode in class Object
• #### equals

public boolean equals​(Object obj)
Overrides:
equals in class Object