Class LaplaceDistribution

  • All Implemented Interfaces:
    Distribution

    @Alias("DoubleExponentialDistribution")
    public class LaplaceDistribution
    extends java.lang.Object
    implements Distribution
    Laplace distribution also known as double exponential distribution
    Since:
    0.6.0
    Author:
    Erich Schubert
    • Field Summary

      Fields 
      Modifier and Type Field Description
      (package private) double location
      Location parameter.
      (package private) double rate
      Rate, inverse of mean
    • 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 val, double rate)
      Cumulative density, static version
      double getLocation()
      Get the location parameter.
      double getRate()
      Get the rate parameter.
      double logpdf​(double val)
      Return the log density of an existing value
      static double logpdf​(double val, double rate)
      PDF, static version
      double nextRandom​(java.util.Random random)
      This method currently uses the naive approach of returning -log(uniform).
      double pdf​(double val)
      Return the density of an existing value
      static double pdf​(double val, double rate)
      PDF, static version
      double quantile​(double val)
      Quantile aka probit (for normal) aka inverse CDF (invcdf, cdf^-1) function.
      static double quantile​(double val, double rate, double location)
      Quantile function, static version
      java.lang.String toString()
      Describe the distribution
      • Methods inherited from class java.lang.Object

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

      • rate

        double rate
        Rate, inverse of mean
      • location

        double location
        Location parameter.
    • Constructor Detail

      • LaplaceDistribution

        public LaplaceDistribution​(double rate)
        Constructor.
        Parameters:
        rate - Rate parameter (1/scale)
      • LaplaceDistribution

        public LaplaceDistribution​(double rate,
                                   double location)
        Constructor.
        Parameters:
        rate - Rate parameter (1/scale)
        location - Location parameter
    • Method Detail

      • getRate

        public double getRate()
        Get the rate parameter.
        Returns:
        Rate parameter
      • getLocation

        public double getLocation()
        Get the location parameter.
        Returns:
        Location
      • 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
      • pdf

        public static double pdf​(double val,
                                 double rate)
        PDF, static version
        Parameters:
        val - Value to compute PDF at
        rate - Rate parameter (1/scale)
        Returns:
        probability 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
      • logpdf

        public static double logpdf​(double val,
                                    double rate)
        PDF, static version
        Parameters:
        val - Value to compute PDF at
        rate - Rate parameter (1/scale)
        Returns:
        probability 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
      • cdf

        public static double cdf​(double val,
                                 double rate)
        Cumulative density, static version
        Parameters:
        val - Value to compute CDF at
        rate - Rate parameter (1/scale)
        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
      • quantile

        public static double quantile​(double val,
                                      double rate,
                                      double location)
        Quantile function, static version
        Parameters:
        val - Value to compute quantile for
        rate - Rate parameter
        location - Location parameter
        Returns:
        Quantile
      • nextRandom

        public double nextRandom​(java.util.Random random)
        This method currently uses the naive approach of returning -log(uniform).
        Specified by:
        nextRandom in interface Distribution
        Parameters:
        random - Random number generator
        Returns:
        new random value
      • toString

        public java.lang.String toString()
        Description copied from interface: Distribution
        Describe the distribution
        Specified by:
        toString in interface Distribution
        Overrides:
        toString in class java.lang.Object
        Returns:
        description