File: weibull.qbk

package info (click to toggle)
boost1.74 1.74.0-9
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 464,084 kB
  • sloc: cpp: 3,338,324; xml: 131,293; python: 33,088; ansic: 14,336; asm: 4,034; sh: 3,351; makefile: 1,193; perl: 1,036; yacc: 478; php: 212; ruby: 102; lisp: 24; sql: 13; csh: 6
file content (131 lines) | stat: -rw-r--r-- 5,287 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
[section:weibull_dist Weibull Distribution]

``#include <boost/math/distributions/weibull.hpp>``

   namespace boost{ namespace math{ 
      
   template <class RealType = double, 
             class ``__Policy``   = ``__policy_class`` >
   class weibull_distribution;
   
   typedef weibull_distribution<> weibull;
   
   template <class RealType, class ``__Policy``>
   class weibull_distribution
   {
   public:
      typedef RealType value_type;
      typedef Policy   policy_type;
      // Construct:
      weibull_distribution(RealType shape, RealType scale = 1)
      // Accessors:
      RealType shape()const;
      RealType scale()const;
   };
   
   }} // namespaces
   
The [@http://en.wikipedia.org/wiki/Weibull_distribution Weibull distribution]
is a continuous distribution
with the 
[@http://en.wikipedia.org/wiki/Probability_density_function probability density function]:

[expression f(x; [alpha], [beta]) = ([alpha]\/[beta]) * (x \/ [beta])[super [alpha] - 1] * e[super -(x\/[beta])[super [alpha]]]]

For shape parameter ['[alpha]] > 0, and scale parameter ['[beta]] > 0, and /x/ > 0.

The Weibull distribution is often used in the field of failure analysis;
in particular it can mimic distributions where the failure rate varies over time.
If the failure rate is:

* constant over time, then ['[alpha]] = 1, suggests that items are failing from random events.
* decreases over time, then ['[alpha]] < 1, suggesting "infant mortality".
* increases over time, then ['[alpha]] > 1, suggesting "wear out" - more likely to fail as time goes by.

The following graph illustrates how the PDF varies with the shape parameter ['[alpha]]:

[graph weibull_pdf1]

While this graph illustrates how the PDF varies with the scale parameter ['[beta]]:

[graph weibull_pdf2]

[h4 Related distributions]

When ['[alpha]] = 3, the
[@http://en.wikipedia.org/wiki/Weibull_distribution Weibull distribution] appears similar to the
[@http://en.wikipedia.org/wiki/Normal_distribution normal distribution].
When ['[alpha]] = 1, the Weibull distribution reduces to the
[@http://en.wikipedia.org/wiki/Exponential_distribution exponential distribution].
The relationship of the types of extreme value distributions, of which the Weibull is but one, is
discussed by
[@http://www.worldscibooks.com/mathematics/p191.html Extreme Value Distributions, Theory and Applications
Samuel Kotz & Saralees Nadarajah].

   
[h4 Member Functions]

   weibull_distribution(RealType shape, RealType scale = 1);
   
Constructs a [@http://en.wikipedia.org/wiki/Weibull_distribution 
Weibull distribution] with shape /shape/ and scale /scale/.

Requires that the /shape/ and /scale/ parameters are both greater than zero, 
otherwise calls __domain_error.

   RealType shape()const;
   
Returns the /shape/ parameter of this distribution.
   
   RealType scale()const;
      
Returns the /scale/ parameter of this distribution.

[h4 Non-member Accessors]

All the [link math_toolkit.dist_ref.nmp usual non-member accessor functions] that are generic to all
distributions are supported: __usual_accessors.

The domain of the random variable is \[0, [infin]\].

[h4 Accuracy]

The Weibull distribution is implemented in terms of the 
standard library `log` and `exp` functions plus __expm1 and __log1p
and as such should have very low error rates.

[h4 Implementation]


In the following table ['[alpha]] is the shape parameter of the distribution, 
['[beta]] is its scale parameter, /x/ is the random variate, /p/ is the probability
and /q = 1-p/.

[table
[[Function][Implementation Notes]]
[[pdf][Using the relation: pdf = [alpha][beta][super -[alpha] ]x[super [alpha] - 1] e[super -(x/beta)[super alpha]] ]]
[[cdf][Using the relation: p = -__expm1(-(x\/[beta])[super [alpha]]) ]]
[[cdf complement][Using the relation: q = e[super -(x\/[beta])[super [alpha]]] ]]
[[quantile][Using the relation: x = [beta] * (-__log1p(-p))[super 1\/[alpha]] ]]
[[quantile from the complement][Using the relation: x = [beta] * (-log(q))[super 1\/[alpha]] ]]
[[mean][[beta] * [Gamma](1 + 1\/[alpha]) ]]
[[variance][[beta][super 2]([Gamma](1 + 2\/[alpha]) - [Gamma][super 2](1 + 1\/[alpha])) ]]
[[mode][[beta](([alpha] - 1) \/ [alpha])[super 1\/[alpha]] ]]
[[skewness][Refer to [@http://mathworld.wolfram.com/WeibullDistribution.html Weisstein, Eric W. "Weibull Distribution." From MathWorld--A Wolfram Web Resource.] ]]
[[kurtosis][Refer to [@http://mathworld.wolfram.com/WeibullDistribution.html Weisstein, Eric W. "Weibull Distribution." From MathWorld--A Wolfram Web Resource.] ]]
[[kurtosis excess][Refer to [@http://mathworld.wolfram.com/WeibullDistribution.html Weisstein, Eric W. "Weibull Distribution." From MathWorld--A Wolfram Web Resource.] ]]
]

[h4 References]
* [@http://en.wikipedia.org/wiki/Weibull_distribution ]
* [@http://mathworld.wolfram.com/WeibullDistribution.html Weisstein, Eric W. "Weibull Distribution." From MathWorld--A Wolfram Web Resource.]
* [@http://www.itl.nist.gov/div898/handbook/eda/section3/eda3668.htm Weibull in NIST Exploratory Data Analysis]

[endsect] [/section:weibull Weibull]

[/ 
  Copyright 2006 John Maddock and Paul A. Bristow.
  Distributed under the Boost Software License, Version 1.0.
  (See accompanying file LICENSE_1_0.txt or copy at
  http://www.boost.org/LICENSE_1_0.txt).
]