The Weibull distribution is a two-parameter family of curves. This distribution is named for Waloddi Weibull, who offered it as an appropriate analytical tool for modeling the breaking strength of materials. Current usage also includes reliability and lifetime modeling. The Weibull distribution is more flexible than the exponential distribution for these purposes, because the exponential distribution has a constant hazard function.
Statistics and Machine Learning Toolbox™ offers several ways to work with the Weibull distribution.
Create a probability distribution object
fitting a probability distribution to sample data (
fitdist) or by specifying
parameter values (
makedist). Then, use object
functions to evaluate the distribution, generate random numbers, and so
Work with the Weibull distribution interactively by using the Distribution Fitter app. You can export an object from the app and use the object functions.
Use distribution-specific functions (
wblplot) with specified
distribution parameters. The distribution-specific functions can accept
parameters of multiple Weibull distributions.
Statistics and Machine Learning Toolbox functions use a two-parameter Weibull distribution with these parameters.
The standard Weibull distribution has unit scale.
The Weibull distribution can take a third parameter. The three-parameter Weibull distribution adds a location parameter that is zero in the two-parameter case. If X has a two-parameter Weibull distribution, then Y = X + c has a three-parameter Weibull distribution with the added location parameter c. For more details, see Three-Parameter Weibull Distribution.
The likelihood function is the probability density
function (pdf) viewed as a function of the parameters. The maximum
likelihood estimates (MLEs) are the parameter estimates that
maximize the likelihood function for fixed values of
maximum likelihood estimators of a and b for the Weibull distribution are the solution of the
â and are unbiased estimators of the parameters a and b.
To fit the Weibull distribution to data and find parameter estimates, use
mle, which return
fitdist returns the fitted probability
WeibullDistribution. The object
b store the parameter
For an example, see Fit Weibull Distribution to Data and Estimate Parameters.
The pdf of the Weibull distribution is
For an example, see Compute Weibull Distribution pdf.
The cumulative distribution function (cdf) of the Weibull distribution is
The result p is the probability that a single observation from a Weibull distribution with parameters a and b falls in the interval [0 x].
For an example, see Compute Weibull Distribution cdf.
The inverse cdf of the Weibull distribution is
The result x is the value where an observation from a Weibull distribution with parameters a and b falls in the range [0 x] with probability p.
The hazard function (instantaneous failure rate) is the ratio of the pdf and the complement of the cdf. If f(t) and F(t) are the pdf and cdf of a distribution, then the hazard rate is . Substituting the pdf and cdf of the exponential distribution for f(t) and F(t) above yields the function .
For an example, see Compare Exponential and Weibull Distribution Hazard Functions.
Simulate the tensile strength data of a thin filament using the Weibull distribution with the scale parameter value
0.5 and the shape parameter value
rng('default'); % For reproducibility strength = wblrnd(0.5,2,100,1); % Simulated strengths
Compute the MLEs and confidence intervals for the Weibull distribution parameters.
[param,ci] = wblfit(strength)
param = 1×2 0.4768 1.9622
ci = 2×2 0.4291 1.6821 0.5298 2.2890
The estimated scale parameter is
0.4768, with the 95% confidence interval
The estimated shape parameter is
1.9622, with the 95% confidence interval
The default confidence interval for each parameter contains the true value.
Compute and plot the pdf of the Weibull distribution for various values of the scale (A) and shape (B) parameters.
x = linspace(0,30); plot(x,wblpdf(x,10,1),'DisplayName','A=10, B=1') hold on plot(x,wblpdf(x,10,2),'DisplayName','A=10, B=2') plot(x,wblpdf(x,10,4),'DisplayName','A=10, B=4') plot(x,wblpdf(x,10,0.5),'DisplayName','A=10, B=0.5') plot(x,wblpdf(x,10,0.25),'DisplayName','A=10, B=0.25') plot(x,wblpdf(x,5,1),'DisplayName','A=5, B=1') hold off legend('show') xlabel('x') ylabel('pdf')
The value B=1 leads to the exponential distribution. Values of B<1 have a density that approaches infinity as x approaches 0. Values of B>1 have a density that approaches 0 as x approaches 1.
Compute and plot the cdf of the Weibull distribution for various values of the scale (A) and shape (B) parameters.
x = linspace(0,30); plot(x,wblcdf(x,10,1),'DisplayName','A=10, B=1') hold on plot(x,wblcdf(x,10,2),'DisplayName','A=10, B=2') plot(x,wblcdf(x,10,4),'DisplayName','A=10, B=4') plot(x,wblcdf(x,10,0.5),'DisplayName','A=10, B=0.5') plot(x,wblcdf(x,10,0.25),'DisplayName','A=10, B=0.25') plot(x,wblcdf(x,5,1),'DisplayName','A=5, B=1') hold off legend('show','Location','southeast') xlabel('x') ylabel('cdf')
The exponential distribution has a constant hazard function, which is not generally the case for the Weibull distribution. In this example, the Weibull hazard rate increases with age (a reasonable assumption).
Compute the hazard function for the Weibull distribution with the scale parameter value
1 and the shape parameter value
t = 0:0.1:4.5; h1 = wblpdf(t,1,2)./(1-wblcdf(t,1,2));
Compute the mean of the Weibull distribution with scale parameter value
1 and shape parameter value
mu = wblstat(1,2)
mu = 0.8862
Compute the hazard function for the exponential distribution with mean
h2 = exppdf(t,mu)./(1-expcdf(t,mu));
Plot both hazard functions on the same axis.
plot(t,h1,'-',t,h2,'--') xlabel('Observation') ylabel('Hazard Rate') legend('Weibull','Exponential','location','northwest')
Exponential Distribution — The exponential distribution is a one-parameter continuous distribution that has parameter μ (mean). This distribution is also used for lifetime modeling. When b = 1, the Weibull distribution is equal to the exponential distribution with mean μ = a.
Extreme Value Distribution — The extreme value distribution is a two-parameter continuous distribution with parameters µ (location) and σ (scale). If X has a Weibull distribution with parameters a and b, then log X has an extreme value distribution with parameters µ = log a and σ = 1/b. This relationship is used to fit data to a Weibull distribution.
Rayleigh Distribution — The Rayleigh distribution is a one-parameter continuous distribution that has parameter b (scale). If A and B are the parameters of the Weibull distribution, then the Rayleigh distribution with parameter b is equivalent to the Weibull distribution with parameters and B = 2.
 Crowder, Martin J., ed. Statistical Analysis of Reliability Data. Reprinted. London: Chapman & Hall, 1995.
 Devroye, Luc. Non-Uniform Random Variate Generation. New York, NY: Springer New York, 1986. https://doi.org/10.1007/978-1-4613-8643-8
 Evans, Merran, Nicholas Hastings, and Brian Peacock. Statistical Distributions. 2nd ed. New York: J. Wiley, 1993.
 Lawless, Jerald F. Statistical Models and Methods for Lifetime Data. 2nd ed. Wiley Series in Probability and Statistics. Hoboken, N.J: Wiley-Interscience, 2003.
 Meeker, William Q., and Luis A. Escobar. Statistical Methods for Reliability Data. Wiley Series in Probability and Statistics. Applied Probability and Statistics Section. New York: Wiley, 1998.