• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1[section:weibull_dist Weibull Distribution]
2
3``#include <boost/math/distributions/weibull.hpp>``
4
5   namespace boost{ namespace math{
6
7   template <class RealType = double,
8             class ``__Policy``   = ``__policy_class`` >
9   class weibull_distribution;
10
11   typedef weibull_distribution<> weibull;
12
13   template <class RealType, class ``__Policy``>
14   class weibull_distribution
15   {
16   public:
17      typedef RealType value_type;
18      typedef Policy   policy_type;
19      // Construct:
20      weibull_distribution(RealType shape, RealType scale = 1)
21      // Accessors:
22      RealType shape()const;
23      RealType scale()const;
24   };
25
26   }} // namespaces
27
28The [@http://en.wikipedia.org/wiki/Weibull_distribution Weibull distribution]
29is a continuous distribution
30with the
31[@http://en.wikipedia.org/wiki/Probability_density_function probability density function]:
32
33[expression f(x; [alpha], [beta]) = ([alpha]\/[beta]) * (x \/ [beta])[super [alpha] - 1] * e[super -(x\/[beta])[super [alpha]]]]
34
35For shape parameter ['[alpha]] > 0, and scale parameter ['[beta]] > 0, and /x/ > 0.
36
37The Weibull distribution is often used in the field of failure analysis;
38in particular it can mimic distributions where the failure rate varies over time.
39If the failure rate is:
40
41* constant over time, then ['[alpha]] = 1, suggests that items are failing from random events.
42* decreases over time, then ['[alpha]] < 1, suggesting "infant mortality".
43* increases over time, then ['[alpha]] > 1, suggesting "wear out" - more likely to fail as time goes by.
44
45The following graph illustrates how the PDF varies with the shape parameter ['[alpha]]:
46
47[graph weibull_pdf1]
48
49While this graph illustrates how the PDF varies with the scale parameter ['[beta]]:
50
51[graph weibull_pdf2]
52
53[h4 Related distributions]
54
55When ['[alpha]] = 3, the
56[@http://en.wikipedia.org/wiki/Weibull_distribution Weibull distribution] appears similar to the
57[@http://en.wikipedia.org/wiki/Normal_distribution normal distribution].
58When ['[alpha]] = 1, the Weibull distribution reduces to the
59[@http://en.wikipedia.org/wiki/Exponential_distribution exponential distribution].
60The relationship of the types of extreme value distributions, of which the Weibull is but one, is
61discussed by
62[@http://www.worldscibooks.com/mathematics/p191.html Extreme Value Distributions, Theory and Applications
63Samuel Kotz & Saralees Nadarajah].
64
65
66[h4 Member Functions]
67
68   weibull_distribution(RealType shape, RealType scale = 1);
69
70Constructs a [@http://en.wikipedia.org/wiki/Weibull_distribution
71Weibull distribution] with shape /shape/ and scale /scale/.
72
73Requires that the /shape/ and /scale/ parameters are both greater than zero,
74otherwise calls __domain_error.
75
76   RealType shape()const;
77
78Returns the /shape/ parameter of this distribution.
79
80   RealType scale()const;
81
82Returns the /scale/ parameter of this distribution.
83
84[h4 Non-member Accessors]
85
86All the [link math_toolkit.dist_ref.nmp usual non-member accessor functions] that are generic to all
87distributions are supported: __usual_accessors.
88
89The domain of the random variable is \[0, [infin]\].
90
91[h4 Accuracy]
92
93The Weibull distribution is implemented in terms of the
94standard library `log` and `exp` functions plus __expm1 and __log1p
95and as such should have very low error rates.
96
97[h4 Implementation]
98
99
100In the following table ['[alpha]] is the shape parameter of the distribution,
101['[beta]] is its scale parameter, /x/ is the random variate, /p/ is the probability
102and /q = 1-p/.
103
104[table
105[[Function][Implementation Notes]]
106[[pdf][Using the relation: pdf = [alpha][beta][super -[alpha] ]x[super [alpha] - 1] e[super -(x/beta)[super alpha]] ]]
107[[cdf][Using the relation: p = -__expm1(-(x\/[beta])[super [alpha]]) ]]
108[[cdf complement][Using the relation: q = e[super -(x\/[beta])[super [alpha]]] ]]
109[[quantile][Using the relation: x = [beta] * (-__log1p(-p))[super 1\/[alpha]] ]]
110[[quantile from the complement][Using the relation: x = [beta] * (-log(q))[super 1\/[alpha]] ]]
111[[mean][[beta] * [Gamma](1 + 1\/[alpha]) ]]
112[[variance][[beta][super 2]([Gamma](1 + 2\/[alpha]) - [Gamma][super 2](1 + 1\/[alpha])) ]]
113[[mode][[beta](([alpha] - 1) \/ [alpha])[super 1\/[alpha]] ]]
114[[skewness][Refer to [@http://mathworld.wolfram.com/WeibullDistribution.html Weisstein, Eric W. "Weibull Distribution." From MathWorld--A Wolfram Web Resource.] ]]
115[[kurtosis][Refer to [@http://mathworld.wolfram.com/WeibullDistribution.html Weisstein, Eric W. "Weibull Distribution." From MathWorld--A Wolfram Web Resource.] ]]
116[[kurtosis excess][Refer to [@http://mathworld.wolfram.com/WeibullDistribution.html Weisstein, Eric W. "Weibull Distribution." From MathWorld--A Wolfram Web Resource.] ]]
117]
118
119[h4 References]
120* [@http://en.wikipedia.org/wiki/Weibull_distribution ]
121* [@http://mathworld.wolfram.com/WeibullDistribution.html Weisstein, Eric W. "Weibull Distribution." From MathWorld--A Wolfram Web Resource.]
122* [@http://www.itl.nist.gov/div898/handbook/eda/section3/eda3668.htm Weibull in NIST Exploratory Data Analysis]
123
124[endsect] [/section:weibull Weibull]
125
126[/
127  Copyright 2006 John Maddock and Paul A. Bristow.
128  Distributed under the Boost Software License, Version 1.0.
129  (See accompanying file LICENSE_1_0.txt or copy at
130  http://www.boost.org/LICENSE_1_0.txt).
131]
132