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.11.0">
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">
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>
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>
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"><</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">></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>
32 <span class="keyword">template</span> <span class="special"><</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 20. 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<></a> <span class="special">></span>
34 <span class="keyword">class</span> <span class="identifier">weibull_distribution</span><span class="special">;</span>
36 <span class="keyword">typedef</span> <span class="identifier">weibull_distribution</span><span class="special"><></span> <span class="identifier">weibull</span><span class="special">;</span>
38 <span class="keyword">template</span> <span class="special"><</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 20. Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">></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>
51 <span class="special">}}</span> <span class="comment">// namespaces</span>
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
58 <div class="blockquote"><blockquote class="blockquote"><p>
59 <span class="serif_italic">f(x; α, β) = (α/β) * (x / β)<sup>α - 1</sup> * e<sup>-(x/β)<sup>α</sup></sup></span>
60 </p></blockquote></div>
62 For shape parameter <span class="emphasis"><em>α</em></span> > 0, and scale parameter
63 <span class="emphasis"><em>β</em></span> > 0, and <span class="emphasis"><em>x</em></span> > 0.
66 The Weibull distribution is often used in the field of failure analysis;
67 in particular it can mimic distributions where the failure rate varies
68 over time. If the failure rate is:
70 <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
72 constant over time, then <span class="emphasis"><em>α</em></span> = 1, suggests that items
73 are failing from random events.
76 decreases over time, then <span class="emphasis"><em>α</em></span> < 1, suggesting
80 increases over time, then <span class="emphasis"><em>α</em></span> > 1, suggesting
81 "wear out" - more likely to fail as time goes by.
85 The following graph illustrates how the PDF varies with the shape parameter
86 <span class="emphasis"><em>α</em></span>:
88 <div class="blockquote"><blockquote class="blockquote"><p>
89 <span class="inlinemediaobject"><img src="../../../../graphs/weibull_pdf1.svg" align="middle"></span>
91 </p></blockquote></div>
93 While this graph illustrates how the PDF varies with the scale parameter
94 <span class="emphasis"><em>β</em></span>:
96 <div class="blockquote"><blockquote class="blockquote"><p>
97 <span class="inlinemediaobject"><img src="../../../../graphs/weibull_pdf2.svg" align="middle"></span>
99 </p></blockquote></div>
101 <a name="math_toolkit.dist_ref.dists.weibull_dist.h0"></a>
102 <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
106 When <span class="emphasis"><em>α</em></span> = 3, the <a href="http://en.wikipedia.org/wiki/Weibull_distribution" target="_top">Weibull
107 distribution</a> appears similar to the <a href="http://en.wikipedia.org/wiki/Normal_distribution" target="_top">normal
108 distribution</a>. When <span class="emphasis"><em>α</em></span> = 1, the Weibull distribution
109 reduces to the <a href="http://en.wikipedia.org/wiki/Exponential_distribution" target="_top">exponential
110 distribution</a>. The relationship of the types of extreme value distributions,
111 of which the Weibull is but one, is discussed by <a href="http://www.worldscibooks.com/mathematics/p191.html" target="_top">Extreme
112 Value Distributions, Theory and Applications Samuel Kotz & Saralees
116 <a name="math_toolkit.dist_ref.dists.weibull_dist.h1"></a>
117 <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
120 <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>
123 Constructs a <a href="http://en.wikipedia.org/wiki/Weibull_distribution" target="_top">Weibull
124 distribution</a> with shape <span class="emphasis"><em>shape</em></span> and scale <span class="emphasis"><em>scale</em></span>.
127 Requires that the <span class="emphasis"><em>shape</em></span> and <span class="emphasis"><em>scale</em></span>
128 parameters are both greater than zero, otherwise calls <a class="link" href="../../error_handling.html#math_toolkit.error_handling.domain_error">domain_error</a>.
130 <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>
133 Returns the <span class="emphasis"><em>shape</em></span> parameter of this distribution.
135 <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>
138 Returns the <span class="emphasis"><em>scale</em></span> parameter of this distribution.
141 <a name="math_toolkit.dist_ref.dists.weibull_dist.h2"></a>
142 <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
146 All the <a class="link" href="../nmp.html" title="Non-Member Properties">usual non-member accessor
147 functions</a> that are generic to all distributions are supported:
148 <a class="link" href="../nmp.html#math_toolkit.dist_ref.nmp.cdf">Cumulative Distribution Function</a>,
149 <a class="link" href="../nmp.html#math_toolkit.dist_ref.nmp.pdf">Probability Density Function</a>,
150 <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>,
151 <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>,
152 <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>,
153 <a class="link" href="../nmp.html#math_toolkit.dist_ref.nmp.sd">standard deviation</a>,
154 <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>,
155 <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>.
158 The domain of the random variable is [0, ∞].
161 <a name="math_toolkit.dist_ref.dists.weibull_dist.h3"></a>
162 <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>
165 The Weibull distribution is implemented in terms of the standard library
166 <code class="computeroutput"><span class="identifier">log</span></code> and <code class="computeroutput"><span class="identifier">exp</span></code>
167 functions plus <a class="link" href="../../powers/expm1.html" title="expm1">expm1</a> and
168 <a class="link" href="../../powers/log1p.html" title="log1p">log1p</a> and as such should
169 have very low error rates.
172 <a name="math_toolkit.dist_ref.dists.weibull_dist.h4"></a>
173 <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>
176 In the following table <span class="emphasis"><em>α</em></span> is the shape parameter of
177 the distribution, <span class="emphasis"><em>β</em></span> is its scale parameter, <span class="emphasis"><em>x</em></span>
178 is the random variate, <span class="emphasis"><em>p</em></span> is the probability and <span class="emphasis"><em>q
181 <div class="informaltable"><table class="table">
207 Using the relation: pdf = αβ<sup>-α </sup>x<sup>α - 1</sup> e<sup>-(x/beta)<sup>alpha</sup></sup>
219 Using the relation: p = -<a class="link" href="../../powers/expm1.html" title="expm1">expm1</a>(-(x/β)<sup>α</sup>)
231 Using the relation: q = e<sup>-(x/β)<sup>α</sup></sup>
243 Using the relation: x = β * (-<a class="link" href="../../powers/log1p.html" title="log1p">log1p</a>(-p))<sup>1/α</sup>
250 quantile from the complement
255 Using the relation: x = β * (-log(q))<sup>1/α</sup>
267 β * Γ(1 + 1/α)
279 β<sup>2</sup>(Γ(1 + 2/α) - Γ<sup>2</sup>(1 + 1/α))
291 β((α - 1) / α)<sup>1/α</sup>
303 Refer to <a href="http://mathworld.wolfram.com/WeibullDistribution.html" target="_top">Weisstein,
304 Eric W. "Weibull Distribution." From MathWorld--A Wolfram
317 Refer to <a href="http://mathworld.wolfram.com/WeibullDistribution.html" target="_top">Weisstein,
318 Eric W. "Weibull Distribution." From MathWorld--A Wolfram
331 Refer to <a href="http://mathworld.wolfram.com/WeibullDistribution.html" target="_top">Weisstein,
332 Eric W. "Weibull Distribution." From MathWorld--A Wolfram
340 <a name="math_toolkit.dist_ref.dists.weibull_dist.h5"></a>
341 <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>
343 <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
344 <li class="listitem">
345 <a href="http://en.wikipedia.org/wiki/Weibull_distribution" target="_top">http://en.wikipedia.org/wiki/Weibull_distribution</a>
347 <li class="listitem">
348 <a href="http://mathworld.wolfram.com/WeibullDistribution.html" target="_top">Weisstein,
349 Eric W. "Weibull Distribution." From MathWorld--A Wolfram
352 <li class="listitem">
353 <a href="http://www.itl.nist.gov/div898/handbook/eda/section3/eda3668.htm" target="_top">Weibull
354 in NIST Exploratory Data Analysis</a>
358 <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
359 <td align="left"></td>
360 <td align="right"><div class="copyright-footer">Copyright © 2006-2019 Nikhar
361 Agrawal, Anton Bikineev, Paul A. Bristow, Marco Guazzone, Christopher Kormanyos,
362 Hubert Holin, Bruno Lalande, John Maddock, Jeremy Murphy, Matthew Pulver, Johan
363 Råde, Gautam Sewani, Benjamin Sobotta, Nicholas Thompson, Thijs van den Berg,
364 Daryle Walker and Xiaogang Zhang<p>
365 Distributed under the Boost Software License, Version 1.0. (See accompanying
366 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>)
371 <div class="spirit-nav">
372 <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>