# Weibull distribution

(Redirected from Weibull)

Release: 4.6  •  5.0  •  5.1  •  5.2  •  5.3  •  5.4  •  6.0  •  6.1  •  6.2  •  6.3

The Weibull distribution is often used to represent failure time in reliability models. It is similar in shape to the gamma distribution, but tends to be less skewed and tail-heavy. It is a continuous distribution over the positive real numbers.

Weibull(10, 4) → ## Functions

Both parameters most be positive, i.e., $\displaystyle{ shape, scale \gt 0 }$. The «scale» parameter is optional and defaults to 1.

### Weibull(shape, scale, over)

The distribution function. Use this to define a chance variable or other uncertain quantity as having a Weibull distribution.

You can use the optional «over» parameter to generate independent and identically distributed distributions over one or more indicated indexes.

### DensWeibull(x, shape, scale )

The density on $\displaystyle{ x\ge 0 }$ is given by:

$\displaystyle{ p(x) = {{shape}\over{scale}} \left({x\over{scale}}\right)^{shape-1} \exp\left(-(x/{scale})^{shape}\right) }$

### CumWeibull(x, shape, scale )

The Weibull distribution has a cumulative density on $\displaystyle{ x\ge 0 }$ given by:

$\displaystyle{ F(x) = 1 - \exp\left({-\left({x\over{scale}}\right)^{shape}}\right) }$

and F(x) = 0 for x < 0.

### CumWeibullInv(p, shape, scale )

The inverse cumulative distribution, or quantile function. Returns the «p»th fractile/quantile/percentile.

$\displaystyle{ F^{-1}(p) = scale * \left( \ln\left( 1\over{1-p} \right)\right)^{1/shape} }$

## Statistics

The theoretical statistics (i.e., without sampling error) for the Weibull distribution are as follows. I use $\displaystyle{ \alpha = 1/shape }$ and $\displaystyle{ \beta = scale }$.

• Mean = $\displaystyle{ \beta \Gamma\left( 1 + \alpha\right) }$
• Mode = $\displaystyle{ \left\{ \begin{array}{ll} \beta \left( 1 - \alpha \right)^\alpha & \alpha\gt 1 \\ 0 & \alpha \leq 1 \end{array}\right. }$
• Median = $\displaystyle{ \beta \left( \ln 2\right)^\alpha }$
• Variance = $\displaystyle{ \beta^2 \Gamma(1+2\alpha) - \left(\beta \Gamma(1+\alpha)\right)^2 }$

## Parameter Estimation

Suppose you have sampled historic data in Data, indexed by I, and you want to find the parameters for the best-fit Weibull distribution. The parameters can be estimated using a linear regression as follows:

Index bm := ['b', 'm'];
Var Fx := (Rank(Data, I) - 0.5)/Size(I);
Var Z := Ln(-Ln(1 - Fx));
Var fit := Regression(Z, Array(bm, [1, Ln(Data)]), I, bm);
Var shape := fit[bm = 'm'];
Var b := fit[bm = 'b'];
Var scale := Exp(-b/shape);
[shape, scale]