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