public class WeibullDistribution extends AbstractDistribution
k > 0
is the shape parameter and λ > 0
is the scale parameter
of the distribution. The probability density function is
f(x;λ,k) = k/λ (x/λ)k-1e-(x/λ)kfor
x ≥ 0
.
The Weibull distribution is often used in the field of life data analysis
due to its flexibility - it can mimic the behavior of other statistical
distributions such as the normal and the exponential. If the failure rate
decreases over time, then k < 1
. If the failure rate is
constant over time, then k = 1
. If the failure rate increases
over time, then k > 1
.
An understanding of the failure rate may provide insight as to what is causing the failures:
k = 1
, it is the exponential distribution.
k = 2
, it becomes equivalent to the Rayleigh
distribution, which models the modulus of a two-dimensional uncorrelated
bivariate normal vector.
k = 3.4
, it appears similar to the normal distribution.
Modifier and Type | Field and Description |
---|---|
double |
k
The shape parameter.
|
double |
lambda
The scale parameter.
|
Constructor and Description |
---|
WeibullDistribution(double k)
Constructor.
|
WeibullDistribution(double k,
double lambda)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
double |
cdf(double x)
Cumulative distribution function.
|
double |
entropy()
Shannon entropy of the distribution.
|
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.
|
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.
|
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, sd
public final double k
public final double lambda
public WeibullDistribution(double k)
k
- the shape parameter.public WeibullDistribution(double k, double lambda)
k
- the shape parameter.lambda
- the scale parameter.public int length()
Distribution
public double mean()
Distribution
public double variance()
Distribution
public double entropy()
Distribution
public java.lang.String toString()
toString
in class java.lang.Object
public double rand()
Distribution
public double p(double x)
Distribution
public double logp(double x)
Distribution
public double cdf(double x)
Distribution
public double quantile(double p)
Distribution