public class ExponentialDistribution extends AbstractDistribution implements ExponentialFamily
The exponential distribution may be viewed as a continuous counterpart of the geometric distribution, which describes the number of Bernoulli trials necessary for a discrete process to change state. In contrast, the exponential distribution describes the time for a continuous process to change state.
The probability density function of an exponential distribution is f(x; λ) = λe-λx for x ≥ 0. The cumulative distribution function is given by F(x; λ) = 1 - e-λ x for x ≥ 0. An important property of the exponential distribution is that it is memoryless. This means that if a random variable T is exponentially distributed, its conditional probability obeys Pr(T > s + t | T > s) = Pr(T > t) for all s, t ≥ 0.
In queuing theory, the service times of agents in a system are often modeled as exponentially distributed variables. Reliability theory and reliability engineering also make extensive use of the exponential distribution. Because of the memoryless property of this distribution, it is well-suited to model the constant hazard rate portion of the bathtub curve used in reliability theory. The exponential distribution is however not appropriate to model the overall lifetime of organisms or technical devices, because the "failure rates" here are not constant: more failures occur for very young and for very old systems.
Modifier and Type | Field and Description |
---|---|
double |
lambda
The rate parameter.
|
Constructor and Description |
---|
ExponentialDistribution(double lambda)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
double |
cdf(double x)
Cumulative distribution function.
|
double |
entropy()
Shannon entropy of the distribution.
|
static ExponentialDistribution |
fit(double[] data)
Estimates the distribution parameters by MLE.
|
int |
length()
The number of parameters of the distribution.
|
double |
logp(double x)
The density at x in log scale, which may prevents the underflow problem.
|
Mixture.Component |
M(double[] x,
double[] posteriori)
The M step in the EM algorithm, which depends the specific distribution.
|
double |
mean()
The mean of distribution.
|
double |
p(double x)
The probability density function for continuous distribution
or probability mass function for discrete distribution at x.
|
double |
quantile(double p)
The quantile, the probability to the left of quantile is p.
|
double |
rand()
Generates a random number following this distribution.
|
double |
sd()
The standard deviation of distribution.
|
java.lang.String |
toString() |
double |
variance()
The variance of distribution.
|
inverseTransformSampling, quantile, quantile, rejection
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
likelihood, logLikelihood, rand
public ExponentialDistribution(double lambda)
lambda
- rate parameter.public static ExponentialDistribution fit(double[] data)
public int length()
Distribution
length
in interface Distribution
public double mean()
Distribution
mean
in interface Distribution
public double variance()
Distribution
variance
in interface Distribution
public double sd()
Distribution
sd
in interface Distribution
public double entropy()
Distribution
entropy
in interface Distribution
public java.lang.String toString()
toString
in class java.lang.Object
public double rand()
Distribution
rand
in interface Distribution
public double p(double x)
Distribution
p
in interface Distribution
public double logp(double x)
Distribution
logp
in interface Distribution
public double cdf(double x)
Distribution
cdf
in interface Distribution
public double quantile(double p)
Distribution
quantile
in interface Distribution
public Mixture.Component M(double[] x, double[] posteriori)
ExponentialFamily
M
in interface ExponentialFamily
x
- the input data for estimationposteriori
- the posteriori probability.