Imported Upstream version 1.64.0
[platform/upstream/boost.git] / libs / math / doc / html / math_toolkit / dist_ref / dists / weibull_dist.html
1 <html>
2 <head>
3 <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
4 <title>Weibull Distribution</title>
5 <link rel="stylesheet" href="../../../math.css" type="text/css">
6 <meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
7 <link rel="home" href="../../../index.html" title="Math Toolkit 2.5.2">
8 <link rel="up" href="../dists.html" title="Distributions">
9 <link rel="prev" href="uniform_dist.html" title="Uniform Distribution">
10 <link rel="next" href="../dist_algorithms.html" title="Distribution Algorithms">
11 </head>
12 <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
13 <table cellpadding="2" width="100%"><tr>
14 <td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../boost.png"></td>
15 <td align="center"><a href="../../../../../../../index.html">Home</a></td>
16 <td align="center"><a href="../../../../../../../libs/libraries.htm">Libraries</a></td>
17 <td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
18 <td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
19 <td align="center"><a href="../../../../../../../more/index.htm">More</a></td>
20 </tr></table>
21 <hr>
22 <div class="spirit-nav">
23 <a accesskey="p" href="uniform_dist.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../dists.html"><img src="../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="../dist_algorithms.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
24 </div>
25 <div class="section">
26 <div class="titlepage"><div><div><h4 class="title">
27 <a name="math_toolkit.dist_ref.dists.weibull_dist"></a><a class="link" href="weibull_dist.html" title="Weibull Distribution">Weibull Distribution</a>
28 </h4></div></div></div>
29 <pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">math</span><span class="special">/</span><span class="identifier">distributions</span><span class="special">/</span><span class="identifier">weibull</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span></pre>
30 <pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">{</span> <span class="keyword">namespace</span> <span class="identifier">math</span><span class="special">{</span>
31
32 <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">RealType</span> <span class="special">=</span> <span class="keyword">double</span><span class="special">,</span>
33           <span class="keyword">class</span> <a class="link" href="../../../policy.html" title="Chapter&#160;15.&#160;Policies: Controlling Precision, Error Handling etc">Policy</a>   <span class="special">=</span> <a class="link" href="../../pol_ref/pol_ref_ref.html" title="Policy Class Reference">policies::policy&lt;&gt;</a> <span class="special">&gt;</span>
34 <span class="keyword">class</span> <span class="identifier">weibull_distribution</span><span class="special">;</span>
35
36 <span class="keyword">typedef</span> <span class="identifier">weibull_distribution</span><span class="special">&lt;&gt;</span> <span class="identifier">weibull</span><span class="special">;</span>
37
38 <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">RealType</span><span class="special">,</span> <span class="keyword">class</span> <a class="link" href="../../../policy.html" title="Chapter&#160;15.&#160;Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">&gt;</span>
39 <span class="keyword">class</span> <span class="identifier">weibull_distribution</span>
40 <span class="special">{</span>
41 <span class="keyword">public</span><span class="special">:</span>
42    <span class="keyword">typedef</span> <span class="identifier">RealType</span> <span class="identifier">value_type</span><span class="special">;</span>
43    <span class="keyword">typedef</span> <span class="identifier">Policy</span>   <span class="identifier">policy_type</span><span class="special">;</span>
44    <span class="comment">// Construct:</span>
45    <span class="identifier">weibull_distribution</span><span class="special">(</span><span class="identifier">RealType</span> <span class="identifier">shape</span><span class="special">,</span> <span class="identifier">RealType</span> <span class="identifier">scale</span> <span class="special">=</span> <span class="number">1</span><span class="special">)</span>
46    <span class="comment">// Accessors:</span>
47    <span class="identifier">RealType</span> <span class="identifier">shape</span><span class="special">()</span><span class="keyword">const</span><span class="special">;</span>
48    <span class="identifier">RealType</span> <span class="identifier">scale</span><span class="special">()</span><span class="keyword">const</span><span class="special">;</span>
49 <span class="special">};</span>
50
51 <span class="special">}}</span> <span class="comment">// namespaces</span>
52 </pre>
53 <p>
54           The <a href="http://en.wikipedia.org/wiki/Weibull_distribution" target="_top">Weibull
55           distribution</a> is a continuous distribution with the <a href="http://en.wikipedia.org/wiki/Probability_density_function" target="_top">probability
56           density function</a>:
57         </p>
58 <p>
59           f(x; &#945;, &#946;) = (&#945;/&#946;) * (x / &#946;)<sup>&#945; - 1</sup> * e<sup>-(x/&#946;)<sup>&#945;</sup></sup>
60         </p>
61 <p>
62           For shape parameter &#945; &#160; &gt; 0, and scale parameter &#946; &#160; &gt; 0, and x &gt; 0.
63         </p>
64 <p>
65           The Weibull distribution is often used in the field of failure analysis;
66           in particular it can mimic distributions where the failure rate varies
67           over time. If the failure rate is:
68         </p>
69 <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
70 <li class="listitem">
71               constant over time, then &#945; &#160; = 1, suggests that items are failing from
72               random events.
73             </li>
74 <li class="listitem">
75               decreases over time, then &#945; &#160; &lt; 1, suggesting "infant mortality".
76             </li>
77 <li class="listitem">
78               increases over time, then &#945; &#160; &gt; 1, suggesting "wear out" -
79               more likely to fail as time goes by.
80             </li>
81 </ul></div>
82 <p>
83           The following graph illustrates how the PDF varies with the shape parameter
84           &#945;:
85         </p>
86 <p>
87           <span class="inlinemediaobject"><img src="../../../../graphs/weibull_pdf1.svg" align="middle"></span>
88         </p>
89 <p>
90           While this graph illustrates how the PDF varies with the scale parameter
91           &#946;:
92         </p>
93 <p>
94           <span class="inlinemediaobject"><img src="../../../../graphs/weibull_pdf2.svg" align="middle"></span>
95         </p>
96 <h5>
97 <a name="math_toolkit.dist_ref.dists.weibull_dist.h0"></a>
98           <span class="phrase"><a name="math_toolkit.dist_ref.dists.weibull_dist.related_distributions"></a></span><a class="link" href="weibull_dist.html#math_toolkit.dist_ref.dists.weibull_dist.related_distributions">Related
99           distributions</a>
100         </h5>
101 <p>
102           When &#945; &#160; = 3, the <a href="http://en.wikipedia.org/wiki/Weibull_distribution" target="_top">Weibull
103           distribution</a> appears similar to the <a href="http://en.wikipedia.org/wiki/Normal_distribution" target="_top">normal
104           distribution</a>. When &#945; &#160; = 1, the Weibull distribution reduces to the
105           <a href="http://en.wikipedia.org/wiki/Exponential_distribution" target="_top">exponential
106           distribution</a>. The relationship of the types of extreme value distributions,
107           of which the Weibull is but one, is discussed by <a href="http://www.worldscibooks.com/mathematics/p191.html" target="_top">Extreme
108           Value Distributions, Theory and Applications Samuel Kotz &amp; Saralees
109           Nadarajah</a>.
110         </p>
111 <h5>
112 <a name="math_toolkit.dist_ref.dists.weibull_dist.h1"></a>
113           <span class="phrase"><a name="math_toolkit.dist_ref.dists.weibull_dist.member_functions"></a></span><a class="link" href="weibull_dist.html#math_toolkit.dist_ref.dists.weibull_dist.member_functions">Member
114           Functions</a>
115         </h5>
116 <pre class="programlisting"><span class="identifier">weibull_distribution</span><span class="special">(</span><span class="identifier">RealType</span> <span class="identifier">shape</span><span class="special">,</span> <span class="identifier">RealType</span> <span class="identifier">scale</span> <span class="special">=</span> <span class="number">1</span><span class="special">);</span>
117 </pre>
118 <p>
119           Constructs a <a href="http://en.wikipedia.org/wiki/Weibull_distribution" target="_top">Weibull
120           distribution</a> with shape <span class="emphasis"><em>shape</em></span> and scale <span class="emphasis"><em>scale</em></span>.
121         </p>
122 <p>
123           Requires that the <span class="emphasis"><em>shape</em></span> and <span class="emphasis"><em>scale</em></span>
124           parameters are both greater than zero, otherwise calls <a class="link" href="../../error_handling.html#math_toolkit.error_handling.domain_error">domain_error</a>.
125         </p>
126 <pre class="programlisting"><span class="identifier">RealType</span> <span class="identifier">shape</span><span class="special">()</span><span class="keyword">const</span><span class="special">;</span>
127 </pre>
128 <p>
129           Returns the <span class="emphasis"><em>shape</em></span> parameter of this distribution.
130         </p>
131 <pre class="programlisting"><span class="identifier">RealType</span> <span class="identifier">scale</span><span class="special">()</span><span class="keyword">const</span><span class="special">;</span>
132 </pre>
133 <p>
134           Returns the <span class="emphasis"><em>scale</em></span> parameter of this distribution.
135         </p>
136 <h5>
137 <a name="math_toolkit.dist_ref.dists.weibull_dist.h2"></a>
138           <span class="phrase"><a name="math_toolkit.dist_ref.dists.weibull_dist.non_member_accessors"></a></span><a class="link" href="weibull_dist.html#math_toolkit.dist_ref.dists.weibull_dist.non_member_accessors">Non-member
139           Accessors</a>
140         </h5>
141 <p>
142           All the <a class="link" href="../nmp.html" title="Non-Member Properties">usual non-member accessor
143           functions</a> that are generic to all distributions are supported:
144           <a class="link" href="../nmp.html#math_toolkit.dist_ref.nmp.cdf">Cumulative Distribution Function</a>,
145           <a class="link" href="../nmp.html#math_toolkit.dist_ref.nmp.pdf">Probability Density Function</a>,
146           <a class="link" href="../nmp.html#math_toolkit.dist_ref.nmp.quantile">Quantile</a>, <a class="link" href="../nmp.html#math_toolkit.dist_ref.nmp.hazard">Hazard Function</a>, <a class="link" href="../nmp.html#math_toolkit.dist_ref.nmp.chf">Cumulative Hazard Function</a>,
147           <a class="link" href="../nmp.html#math_toolkit.dist_ref.nmp.mean">mean</a>, <a class="link" href="../nmp.html#math_toolkit.dist_ref.nmp.median">median</a>,
148           <a class="link" href="../nmp.html#math_toolkit.dist_ref.nmp.mode">mode</a>, <a class="link" href="../nmp.html#math_toolkit.dist_ref.nmp.variance">variance</a>,
149           <a class="link" href="../nmp.html#math_toolkit.dist_ref.nmp.sd">standard deviation</a>,
150           <a class="link" href="../nmp.html#math_toolkit.dist_ref.nmp.skewness">skewness</a>, <a class="link" href="../nmp.html#math_toolkit.dist_ref.nmp.kurtosis">kurtosis</a>, <a class="link" href="../nmp.html#math_toolkit.dist_ref.nmp.kurtosis_excess">kurtosis_excess</a>,
151           <a class="link" href="../nmp.html#math_toolkit.dist_ref.nmp.range">range</a> and <a class="link" href="../nmp.html#math_toolkit.dist_ref.nmp.support">support</a>.
152         </p>
153 <p>
154           The domain of the random variable is [0, &#8734;].
155         </p>
156 <h5>
157 <a name="math_toolkit.dist_ref.dists.weibull_dist.h3"></a>
158           <span class="phrase"><a name="math_toolkit.dist_ref.dists.weibull_dist.accuracy"></a></span><a class="link" href="weibull_dist.html#math_toolkit.dist_ref.dists.weibull_dist.accuracy">Accuracy</a>
159         </h5>
160 <p>
161           The Weibull distribution is implemented in terms of the standard library
162           <code class="computeroutput"><span class="identifier">log</span></code> and <code class="computeroutput"><span class="identifier">exp</span></code>
163           functions plus <a class="link" href="../../powers/expm1.html" title="expm1">expm1</a> and
164           <a class="link" href="../../powers/log1p.html" title="log1p">log1p</a> and as such should
165           have very low error rates.
166         </p>
167 <h5>
168 <a name="math_toolkit.dist_ref.dists.weibull_dist.h4"></a>
169           <span class="phrase"><a name="math_toolkit.dist_ref.dists.weibull_dist.implementation"></a></span><a class="link" href="weibull_dist.html#math_toolkit.dist_ref.dists.weibull_dist.implementation">Implementation</a>
170         </h5>
171 <p>
172           In the following table &#945; &#160; is the shape parameter of the distribution, &#946; &#160; is its
173           scale parameter, <span class="emphasis"><em>x</em></span> is the random variate, <span class="emphasis"><em>p</em></span>
174           is the probability and <span class="emphasis"><em>q = 1-p</em></span>.
175         </p>
176 <div class="informaltable"><table class="table">
177 <colgroup>
178 <col>
179 <col>
180 </colgroup>
181 <thead><tr>
182 <th>
183                   <p>
184                     Function
185                   </p>
186                 </th>
187 <th>
188                   <p>
189                     Implementation Notes
190                   </p>
191                 </th>
192 </tr></thead>
193 <tbody>
194 <tr>
195 <td>
196                   <p>
197                     pdf
198                   </p>
199                 </td>
200 <td>
201                   <p>
202                     Using the relation: pdf = &#945;&#946;<sup>-&#945; </sup>x<sup>&#945; - 1</sup> e<sup>-(x/beta)<sup>alpha</sup></sup>
203                   </p>
204                 </td>
205 </tr>
206 <tr>
207 <td>
208                   <p>
209                     cdf
210                   </p>
211                 </td>
212 <td>
213                   <p>
214                     Using the relation: p = -<a class="link" href="../../powers/expm1.html" title="expm1">expm1</a>(-(x/&#946;)<sup>&#945;</sup>)
215                   </p>
216                 </td>
217 </tr>
218 <tr>
219 <td>
220                   <p>
221                     cdf complement
222                   </p>
223                 </td>
224 <td>
225                   <p>
226                     Using the relation: q = e<sup>-(x/&#946;)<sup>&#945;</sup></sup>
227                   </p>
228                 </td>
229 </tr>
230 <tr>
231 <td>
232                   <p>
233                     quantile
234                   </p>
235                 </td>
236 <td>
237                   <p>
238                     Using the relation: x = &#946; * (-<a class="link" href="../../powers/log1p.html" title="log1p">log1p</a>(-p))<sup>1/&#945;</sup>
239                   </p>
240                 </td>
241 </tr>
242 <tr>
243 <td>
244                   <p>
245                     quantile from the complement
246                   </p>
247                 </td>
248 <td>
249                   <p>
250                     Using the relation: x = &#946; * (-log(q))<sup>1/&#945;</sup>
251                   </p>
252                 </td>
253 </tr>
254 <tr>
255 <td>
256                   <p>
257                     mean
258                   </p>
259                 </td>
260 <td>
261                   <p>
262                     &#946; * &#915;(1 + 1/&#945;)
263                   </p>
264                 </td>
265 </tr>
266 <tr>
267 <td>
268                   <p>
269                     variance
270                   </p>
271                 </td>
272 <td>
273                   <p>
274                     &#946;<sup>2</sup>(&#915;(1 + 2/&#945;) - &#915;<sup>2</sup>(1 + 1/&#945;))
275                   </p>
276                 </td>
277 </tr>
278 <tr>
279 <td>
280                   <p>
281                     mode
282                   </p>
283                 </td>
284 <td>
285                   <p>
286                     &#946;((&#945; - 1) / &#945;)<sup>1/&#945;</sup>
287                   </p>
288                 </td>
289 </tr>
290 <tr>
291 <td>
292                   <p>
293                     skewness
294                   </p>
295                 </td>
296 <td>
297                   <p>
298                     Refer to <a href="http://mathworld.wolfram.com/WeibullDistribution.html" target="_top">Weisstein,
299                     Eric W. "Weibull Distribution." From MathWorld--A Wolfram
300                     Web Resource.</a>
301                   </p>
302                 </td>
303 </tr>
304 <tr>
305 <td>
306                   <p>
307                     kurtosis
308                   </p>
309                 </td>
310 <td>
311                   <p>
312                     Refer to <a href="http://mathworld.wolfram.com/WeibullDistribution.html" target="_top">Weisstein,
313                     Eric W. "Weibull Distribution." From MathWorld--A Wolfram
314                     Web Resource.</a>
315                   </p>
316                 </td>
317 </tr>
318 <tr>
319 <td>
320                   <p>
321                     kurtosis excess
322                   </p>
323                 </td>
324 <td>
325                   <p>
326                     Refer to <a href="http://mathworld.wolfram.com/WeibullDistribution.html" target="_top">Weisstein,
327                     Eric W. "Weibull Distribution." From MathWorld--A Wolfram
328                     Web Resource.</a>
329                   </p>
330                 </td>
331 </tr>
332 </tbody>
333 </table></div>
334 <h5>
335 <a name="math_toolkit.dist_ref.dists.weibull_dist.h5"></a>
336           <span class="phrase"><a name="math_toolkit.dist_ref.dists.weibull_dist.references"></a></span><a class="link" href="weibull_dist.html#math_toolkit.dist_ref.dists.weibull_dist.references">References</a>
337         </h5>
338 <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
339 <li class="listitem">
340               <a href="http://en.wikipedia.org/wiki/Weibull_distribution" target="_top">http://en.wikipedia.org/wiki/Weibull_distribution</a>
341             </li>
342 <li class="listitem">
343               <a href="http://mathworld.wolfram.com/WeibullDistribution.html" target="_top">Weisstein,
344               Eric W. "Weibull Distribution." From MathWorld--A Wolfram
345               Web Resource.</a>
346             </li>
347 <li class="listitem">
348               <a href="http://www.itl.nist.gov/div898/handbook/eda/section3/eda3668.htm" target="_top">Weibull
349               in NIST Exploratory Data Analysis</a>
350             </li>
351 </ul></div>
352 </div>
353 <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
354 <td align="left"></td>
355 <td align="right"><div class="copyright-footer">Copyright &#169; 2006-2010, 2012-2014 Nikhar Agrawal,
356       Anton Bikineev, Paul A. Bristow, Marco Guazzone, Christopher Kormanyos, Hubert
357       Holin, Bruno Lalande, John Maddock, Jeremy Murphy, Johan R&#229;de, Gautam Sewani,
358       Benjamin Sobotta, Thijs van den Berg, Daryle Walker and Xiaogang Zhang<p>
359         Distributed under the Boost Software License, Version 1.0. (See accompanying
360         file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
361       </p>
362 </div></td>
363 </tr></table>
364 <hr>
365 <div class="spirit-nav">
366 <a accesskey="p" href="uniform_dist.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../dists.html"><img src="../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="../dist_algorithms.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
367 </div>
368 </body>
369 </html>