public class ExponentialDistribution extends AbstractDistribution
Modifier and Type | Class and Description |
---|---|
static class |
ExponentialDistribution.Parameterizer
Parameterization class
|
Modifier and Type | Field and Description |
---|---|
(package private) double |
location
Location parameter.
|
(package private) double |
rate
Rate, inverse of mean
|
random
Constructor and Description |
---|
ExponentialDistribution(double rate)
Constructor.
|
ExponentialDistribution(double rate,
double location)
Constructor.
|
ExponentialDistribution(double rate,
double location,
java.util.Random random)
Constructor.
|
ExponentialDistribution(double rate,
double location,
RandomFactory random)
Constructor.
|
ExponentialDistribution(double rate,
java.util.Random random)
Constructor.
|
Modifier and Type | Method and 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 rate parameter.
|
double |
logpdf(double val)
Return the log density of an existing value
|
static double |
logpdf(double val,
double rate)
log PDF, static version
|
double |
nextRandom()
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)
Quantile function, static version
|
java.lang.String |
toString()
Describe the distribution
|
public ExponentialDistribution(double rate)
rate
- Rate parameter (1/scale)public ExponentialDistribution(double rate, double location)
rate
- Rate parameter (1/scale)location
- Location parameterpublic ExponentialDistribution(double rate, java.util.Random random)
rate
- Rate parameter (1/scale)random
- Random generatorpublic ExponentialDistribution(double rate, double location, java.util.Random random)
rate
- Rate parameter (1/scale)location
- Location parameterrandom
- Random generatorpublic ExponentialDistribution(double rate, double location, RandomFactory random)
rate
- Rate parameter (1/scale)location
- Location parameterrandom
- Random generatorpublic double getRate()
public double getLocation()
public double pdf(double val)
Distribution
val
- existing valuepublic double logpdf(double val)
Distribution
val
- existing valuepublic static double pdf(double val, double rate)
val
- Value to compute PDF atrate
- Rate parameter (1/scale)public static double logpdf(double val, double rate)
val
- Value to compute PDF atrate
- Rate parameter (1/scale)public double cdf(double val)
Distribution
val
- existing valuepublic static double cdf(double val, double rate)
val
- Value to compute CDF atrate
- Rate parameter (1/scale)public double quantile(double val)
Distribution
val
- Quantile to findpublic static double quantile(double val, double rate)
val
- Value to compute quantile forrate
- Rate parameterpublic double nextRandom()
-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=361593nextRandom
in interface Distribution
nextRandom
in class AbstractDistribution
public java.lang.String toString()
Distribution
toString
in interface Distribution
toString
in class java.lang.Object
Copyright © 2019 ELKI Development Team. License information.