Class 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 Detail

      • GammaDistribution

        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
      • GammaDistribution

        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
      • 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
      • 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