Class ExpGammaDistribution

  • All Implemented Interfaces:
    Distribution

    public class ExpGammaDistribution
    extends java.lang.Object
    implements Distribution
    Exp-Gamma Distribution, with random generation and density functions.

    This distribution can be outlined as Y ~ log[Gamma] distributed, or equivalently exp(Y) ~ Gamma.

    Note: this matches the loggamma of SciPy, whereas Wolfram calls this the Exponential Gamma Distribution "at times confused with the LogGammaDistribution".

    Since:
    0.6.0
    Author:
    Erich Schubert
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private double k
      Alpha == k.
      private double shift
      Translation offset.
      private double theta
      Theta == 1 / Beta.
    • Constructor Summary

      Constructors 
      Constructor Description
      ExpGammaDistribution​(double k, double theta, double shift)
      Constructor for Gamma distribution.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      double cdf​(double val)
      Return the cumulative density function at the given value.
      static double cdf​(double x, double k, double theta, double shift)
      The CDF, static version.
      double getK()  
      double getTheta()  
      static double logcdf​(double x, double k, double theta, double shift)
      The log CDF, static version.
      double logpdf​(double val)
      Return the log density of an existing value
      static double logpdf​(double x, double k, double theta, double shift)
      ExpGamma distribution logPDF
      double nextRandom​(java.util.Random random)
      Generate a new random value
      double pdf​(double val)
      Return the density of an existing value
      static double pdf​(double x, double k, double theta, double shift)
      ExpGamma distribution PDF (with 0.0 for x < 0)
      double quantile​(double val)
      Quantile aka probit (for normal) aka inverse CDF (invcdf, cdf^-1) function.
      static double quantile​(double p, double k, double theta, double shift)
      Compute probit (inverse cdf) for ExpGamma distributions.
      java.lang.String toString()
      Simple toString explaining the distribution parameters.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • k

        private final double k
        Alpha == k.
      • theta

        private final double theta
        Theta == 1 / Beta.
      • shift

        private final double shift
        Translation offset.
    • Constructor Detail

      • ExpGammaDistribution

        public ExpGammaDistribution​(double k,
                                    double theta,
                                    double shift)
        Constructor for Gamma distribution.
        Parameters:
        k - k, alpha aka. "shape" parameter
        theta - Theta = 1.0/Beta aka. "scaling" parameter
        shift - Location offset
    • Method Detail

      • pdf

        public double pdf​(double val)
        Description copied from interface: Distribution
        Return the density of an existing value
        Specified by:
        pdf in interface Distribution
        Parameters:
        val - existing value
        Returns:
        distribution density
      • logpdf

        public double logpdf​(double val)
        Description copied from interface: Distribution
        Return the log density of an existing value
        Specified by:
        logpdf in interface Distribution
        Parameters:
        val - existing value
        Returns:
        log distribution density
      • cdf

        public double cdf​(double val)
        Description copied from interface: Distribution
        Return the cumulative density function at the given value.
        Specified by:
        cdf in interface Distribution
        Parameters:
        val - existing value
        Returns:
        cumulative density
      • quantile

        public double quantile​(double val)
        Description copied from interface: Distribution
        Quantile aka probit (for normal) aka inverse CDF (invcdf, cdf^-1) function.
        Specified by:
        quantile in interface Distribution
        Parameters:
        val - Quantile to find
        Returns:
        Quantile position
      • nextRandom

        public double nextRandom​(java.util.Random random)
        Description copied from interface: Distribution
        Generate a new random value
        Specified by:
        nextRandom in interface Distribution
        Parameters:
        random - Random number generator
        Returns:
        new random value
      • toString

        public java.lang.String toString()
        Simple toString explaining the distribution parameters. Used in producing a model description.
        Specified by:
        toString in interface Distribution
        Overrides:
        toString in class java.lang.Object
        Returns:
        description
      • getK

        public double getK()
        Returns:
        the value of k
      • getTheta

        public double getTheta()
        Returns:
        the standard deviation
      • cdf

        public static double cdf​(double x,
                                 double k,
                                 double theta,
                                 double shift)
        The CDF, static version.
        Parameters:
        x - Value
        k - Shape k
        theta - Theta = 1.0/Beta aka. "scaling" parameter
        Returns:
        cdf value
      • logcdf

        public static double logcdf​(double x,
                                    double k,
                                    double theta,
                                    double shift)
        The log CDF, static version.
        Parameters:
        x - Value
        k - Shape k
        theta - Theta = 1.0/Beta aka. "scaling" parameter
        Returns:
        cdf value
      • pdf

        public static double pdf​(double x,
                                 double k,
                                 double theta,
                                 double shift)
        ExpGamma distribution PDF (with 0.0 for x < 0)
        Parameters:
        x - query value
        k - Alpha
        theta - Theta = 1 / Beta
        Returns:
        probability density
      • logpdf

        public static double logpdf​(double x,
                                    double k,
                                    double theta,
                                    double shift)
        ExpGamma distribution logPDF
        Parameters:
        x - query value
        k - Alpha
        theta - Theta = 1 / Beta
        Returns:
        log probability density
      • quantile

        public static double quantile​(double p,
                                      double k,
                                      double theta,
                                      double shift)
        Compute probit (inverse cdf) for ExpGamma distributions.
        Parameters:
        p - Probability
        k - k, alpha aka. "shape" parameter
        theta - Theta = 1.0/Beta aka. "scaling" parameter
        shift - Shift parameter
        Returns:
        Probit for ExpGamma distribution