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">
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 15. 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 15. 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
59 f(x; α, β) = (α/β) * (x / β)<sup>α - 1</sup> * e<sup>-(x/β)<sup>α</sup></sup>
62 For shape parameter α   > 0, and scale parameter β   > 0, and x > 0.
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:
69 <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
71 constant over time, then α   = 1, suggests that items are failing from
75 decreases over time, then α   < 1, suggesting "infant mortality".
78 increases over time, then α   > 1, suggesting "wear out" -
79 more likely to fail as time goes by.
83 The following graph illustrates how the PDF varies with the shape parameter
87 <span class="inlinemediaobject"><img src="../../../../graphs/weibull_pdf1.svg" align="middle"></span>
90 While this graph illustrates how the PDF varies with the scale parameter
94 <span class="inlinemediaobject"><img src="../../../../graphs/weibull_pdf2.svg" align="middle"></span>
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
102 When α   = 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 α   = 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 & Saralees
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
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>
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>.
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>.
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>
129 Returns the <span class="emphasis"><em>shape</em></span> parameter of this distribution.
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>
134 Returns the <span class="emphasis"><em>scale</em></span> parameter of this distribution.
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
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>.
154 The domain of the random variable is [0, ∞].
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>
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.
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>
172 In the following table α   is the shape parameter of the distribution, β   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>.
176 <div class="informaltable"><table class="table">
202 Using the relation: pdf = αβ<sup>-α </sup>x<sup>α - 1</sup> e<sup>-(x/beta)<sup>alpha</sup></sup>
214 Using the relation: p = -<a class="link" href="../../powers/expm1.html" title="expm1">expm1</a>(-(x/β)<sup>α</sup>)
226 Using the relation: q = e<sup>-(x/β)<sup>α</sup></sup>
238 Using the relation: x = β * (-<a class="link" href="../../powers/log1p.html" title="log1p">log1p</a>(-p))<sup>1/α</sup>
245 quantile from the complement
250 Using the relation: x = β * (-log(q))<sup>1/α</sup>
262 β * Γ(1 + 1/α)
274 β<sup>2</sup>(Γ(1 + 2/α) - Γ<sup>2</sup>(1 + 1/α))
286 β((α - 1) / α)<sup>1/α</sup>
298 Refer to <a href="http://mathworld.wolfram.com/WeibullDistribution.html" target="_top">Weisstein,
299 Eric W. "Weibull Distribution." From MathWorld--A Wolfram
312 Refer to <a href="http://mathworld.wolfram.com/WeibullDistribution.html" target="_top">Weisstein,
313 Eric W. "Weibull Distribution." From MathWorld--A Wolfram
326 Refer to <a href="http://mathworld.wolfram.com/WeibullDistribution.html" target="_top">Weisstein,
327 Eric W. "Weibull Distribution." From MathWorld--A Wolfram
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>
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>
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
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>
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 © 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å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>)
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>