Class StudentTDistribution
- java.lang.Object
-
- com.opengamma.strata.math.impl.statistics.distribution.StudentTDistribution
-
- All Implemented Interfaces:
ProbabilityDistribution<Double>
public class StudentTDistribution extends Object implements ProbabilityDistribution<Double>
Student's T-distribution is a continuous probability distribution with probability density function $$ \begin{align*} f(x) = \frac{\Gamma\left(\frac{\nu + 1}{2}\right)}{\sqrt{\nu\pi}\Gamma(\left(\frac{\nu}{2}\right)}\ left(1 + \frac{x^2}{\nu}\right)^{-\frac{1}{2}(\nu + 1)} \end{align*} $$ where $\nu$ is the number of degrees of freedom and $\Gamma$ is the Gamma function (GammaFunction).
-
-
Constructor Summary
Constructors Constructor Description StudentTDistribution(double degFreedom)StudentTDistribution(double degFreedom, 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 valuedoublegetDegreesOfFreedom()doublegetInverseCDF(Double p)Given a probability, return the value that returns this cdfdoublegetPDF(Double x)Return the probability density function for a valueinthashCode()doublenextRandom()
-
-
-
Constructor Detail
-
StudentTDistribution
public StudentTDistribution(double degFreedom)
- Parameters:
degFreedom- The number of degrees of freedom, not negative or zero
-
StudentTDistribution
public StudentTDistribution(double degFreedom, RandomEngine engine)- Parameters:
degFreedom- The number of degrees of freedom, not negative or zeroengine- A generator of uniform random numbers, 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
-
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
-
getInverseCDF
public double getInverseCDF(Double p)
Given a probability, return the value that returns this cdf The inverse cdf is given by: $$ \begin{align*} F(P) &= \mathrm{sign}(p - \frac{1}{2})\sqrt{\frac{\nu}{x - 1}}\\ x &= B(2 \min(p, 1-p)) \end{align*} $$ where $B$ is the inverse incomplete Beta function (InverseIncompleteBetaFunction).- Specified by:
getInverseCDFin interfaceProbabilityDistribution<Double>- Parameters:
p- The probability, not null. $0 \geq p \geq 1$- Returns:
- The inverse cdf
-
getDegreesOfFreedom
public double getDegreesOfFreedom()
- Returns:
- The number of degrees of freedom
-
-