Class ExponentialDistribution
- java.lang.Object
-
- elki.math.statistics.distribution.ExponentialDistribution
-
- All Implemented Interfaces:
Distribution
public class ExponentialDistribution extends java.lang.Object implements Distribution
Exponential distribution.- Since:
- 0.5.5
- Author:
- Erich Schubert
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ExponentialDistribution.Par
Parameterization class-
Nested classes/interfaces inherited from interface elki.math.statistics.distribution.Distribution
Distribution.Parameterizer
-
-
Constructor Summary
Constructors Constructor Description ExponentialDistribution(double rate)
Constructor.ExponentialDistribution(double rate, double location)
Constructor.
-
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 versiondouble
getLocation()
Get the location parameter.double
getRate()
Get rate parameter.double
logpdf(double val)
Return the log density of an existing valuestatic double
logpdf(double val, double rate)
log PDF, static versiondouble
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 valuestatic double
pdf(double val, double rate)
PDF, static versiondouble
quantile(double val)
Quantile aka probit (for normal) aka inverse CDF (invcdf, cdf^-1) function.static double
quantile(double val, double rate)
Quantile function, static versionjava.lang.String
toString()
Describe the distribution
-
-
-
Constructor Detail
-
ExponentialDistribution
public ExponentialDistribution(double rate)
Constructor.- Parameters:
rate
- Rate parameter (1/scale)
-
ExponentialDistribution
public ExponentialDistribution(double rate, double location)
Constructor.- Parameters:
rate
- Rate parameter (1/scale)location
- Location parameter
-
-
Method Detail
-
getRate
public double getRate()
Get rate parameter.- Returns:
- Rate
-
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 interfaceDistribution
- 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 interfaceDistribution
- Parameters:
val
- existing value- Returns:
- log distribution density
-
pdf
public static double pdf(double val, double rate)
PDF, static version- Parameters:
val
- Value to compute PDF atrate
- Rate parameter (1/scale)- Returns:
- probability density
-
logpdf
public static double logpdf(double val, double rate)
log PDF, static version- Parameters:
val
- Value to compute PDF atrate
- 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 interfaceDistribution
- 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 atrate
- 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 interfaceDistribution
- Parameters:
val
- Quantile to find- Returns:
- Quantile position
-
quantile
public static double quantile(double val, double rate)
Quantile function, static version- Parameters:
val
- Value to compute quantile forrate
- Rate parameter- Returns:
- Quantile
-
nextRandom
public double nextRandom(java.util.Random random)
This method currently uses the naive approach of returning-log(uniform)
. TODO: there are variants that do not rely on the log method and are faster. We need to implement and evaluate these. For details: see "Computer methods for sampling from the exponential and normal distributions" J. H. Ahrens, U. Dieter, https://dl.acm.org/citation.cfm?id=361593- Specified by:
nextRandom
in interfaceDistribution
- 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 interfaceDistribution
- Overrides:
toString
in classjava.lang.Object
- Returns:
- description
-
-