Class GammaDistribution
- java.lang.Object
-
- com.opengamma.strata.math.impl.statistics.distribution.GammaDistribution
-
- 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 Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object obj)doublegetCDF(Double x)Returns the cumulative distribution function for a valuedoublegetInverseCDF(Double p)Given a probability, return the value that returns this cdfdoublegetK()doublegetPDF(Double x)Return the probability density function for a valuedoublegetTheta()inthashCode()doublenextRandom()
-
-
-
Constructor Detail
-
GammaDistribution
public GammaDistribution(double k, double theta)- Parameters:
k- The shape parameter of the distribution, not negative or zerotheta- The scale parameter of the distribution, not negative or zero
-
GammaDistribution
public GammaDistribution(double k, double theta, RandomEngine engine)- Parameters:
k- The shape parameter of the distribution, not negative or zerotheta- The scale parameter of the distribution, not negative or zeroengine- 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:
getCDFin interfaceProbabilityDistribution<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:
getInverseCDFin interfaceProbabilityDistribution<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:
getPDFin interfaceProbabilityDistribution<Double>- Parameters:
x- The value, not null- Returns:
- The pdf
-
nextRandom
public double nextRandom()
- Specified by:
nextRandomin interfaceProbabilityDistribution<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
-
-