Class 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 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 zero
        engine - 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:
        getCDF in interface ProbabilityDistribution<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:
        getPDF in interface ProbabilityDistribution<Double>
        Parameters:
        x - The value, not null
        Returns:
        The pdf
      • 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:
        getInverseCDF in interface ProbabilityDistribution<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
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object