Imported Upstream version 1.64.0
[platform/upstream/boost.git] / libs / math / doc / html / math_toolkit / dist_ref / dists / extreme_dist.html
1 <html>
2 <head>
3 <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
4 <title>Extreme Value 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="exp_dist.html" title="Exponential Distribution">
10 <link rel="next" href="f_dist.html" title="F Distribution">
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="exp_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="f_dist.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.extreme_dist"></a><a class="link" href="extreme_dist.html" title="Extreme Value Distribution">Extreme Value
28         Distribution</a>
29 </h4></div></div></div>
30 <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">extreme</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span></pre>
31 <pre class="programlisting"><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>
32           <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>
33 <span class="keyword">class</span> <span class="identifier">extreme_value_distribution</span><span class="special">;</span>
34
35 <span class="keyword">typedef</span> <span class="identifier">extreme_value_distribution</span><span class="special">&lt;&gt;</span> <span class="identifier">extreme_value</span><span class="special">;</span>
36
37 <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>
38 <span class="keyword">class</span> <span class="identifier">extreme_value_distribution</span>
39 <span class="special">{</span>
40 <span class="keyword">public</span><span class="special">:</span>
41    <span class="keyword">typedef</span> <span class="identifier">RealType</span> <span class="identifier">value_type</span><span class="special">;</span>
42
43    <span class="identifier">extreme_value_distribution</span><span class="special">(</span><span class="identifier">RealType</span> <span class="identifier">location</span> <span class="special">=</span> <span class="number">0</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>
44
45    <span class="identifier">RealType</span> <span class="identifier">scale</span><span class="special">()</span><span class="keyword">const</span><span class="special">;</span>
46    <span class="identifier">RealType</span> <span class="identifier">location</span><span class="special">()</span><span class="keyword">const</span><span class="special">;</span>
47 <span class="special">};</span>
48 </pre>
49 <p>
50           There are various <a href="http://mathworld.wolfram.com/ExtremeValueDistribution.html" target="_top">extreme
51           value distributions</a> : this implementation represents the maximum
52           case, and is variously known as a Fisher-Tippett distribution, a log-Weibull
53           distribution or a Gumbel distribution.
54         </p>
55 <p>
56           Extreme value theory is important for assessing risk for highly unusual
57           events, such as 100-year floods.
58         </p>
59 <p>
60           More information can be found on the <a href="http://www.itl.nist.gov/div898/handbook/eda/section3/eda366g.htm" target="_top">NIST</a>,
61           <a href="http://en.wikipedia.org/wiki/Extreme_value_distribution" target="_top">Wikipedia</a>,
62           <a href="http://mathworld.wolfram.com/ExtremeValueDistribution.html" target="_top">Mathworld</a>,
63           and <a href="http://en.wikipedia.org/wiki/Extreme_value_theory" target="_top">Extreme
64           value theory</a> websites.
65         </p>
66 <p>
67           The relationship of the types of extreme value distributions, of which
68           this is but one, is discussed by <a href="http://www.worldscibooks.com/mathematics/p191.html" target="_top">Extreme
69           Value Distributions, Theory and Applications Samuel Kotz &amp; Saralees
70           Nadarajah</a>.
71         </p>
72 <p>
73           The distribution has a PDF given by:
74         </p>
75 <p>
76           f(x) = (1/scale) e<sup>-(x-location)/scale</sup> e<sup>-e<sup>-(x-location)/scale</sup></sup>
77         </p>
78 <p>
79           Which in the standard case (scale = 1, location = 0) reduces to:
80         </p>
81 <p>
82           f(x) = e<sup>-x</sup>e<sup>-e<sup>-x</sup></sup>
83         </p>
84 <p>
85           The following graph illustrates how the PDF varies with the location parameter:
86         </p>
87 <p>
88           <span class="inlinemediaobject"><img src="../../../../graphs/extreme_value_pdf1.svg" align="middle"></span>
89         </p>
90 <p>
91           And this graph illustrates how the PDF varies with the shape parameter:
92         </p>
93 <p>
94           <span class="inlinemediaobject"><img src="../../../../graphs/extreme_value_pdf2.svg" align="middle"></span>
95         </p>
96 <h5>
97 <a name="math_toolkit.dist_ref.dists.extreme_dist.h0"></a>
98           <span class="phrase"><a name="math_toolkit.dist_ref.dists.extreme_dist.member_functions"></a></span><a class="link" href="extreme_dist.html#math_toolkit.dist_ref.dists.extreme_dist.member_functions">Member
99           Functions</a>
100         </h5>
101 <pre class="programlisting"><span class="identifier">extreme_value_distribution</span><span class="special">(</span><span class="identifier">RealType</span> <span class="identifier">location</span> <span class="special">=</span> <span class="number">0</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>
102 </pre>
103 <p>
104           Constructs an Extreme Value distribution with the specified location and
105           scale parameters.
106         </p>
107 <p>
108           Requires <code class="computeroutput"><span class="identifier">scale</span> <span class="special">&gt;</span>
109           <span class="number">0</span></code>, otherwise calls <a class="link" href="../../error_handling.html#math_toolkit.error_handling.domain_error">domain_error</a>.
110         </p>
111 <pre class="programlisting"><span class="identifier">RealType</span> <span class="identifier">location</span><span class="special">()</span><span class="keyword">const</span><span class="special">;</span>
112 </pre>
113 <p>
114           Returns the location parameter of the distribution.
115         </p>
116 <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>
117 </pre>
118 <p>
119           Returns the scale parameter of the distribution.
120         </p>
121 <h5>
122 <a name="math_toolkit.dist_ref.dists.extreme_dist.h1"></a>
123           <span class="phrase"><a name="math_toolkit.dist_ref.dists.extreme_dist.non_member_accessors"></a></span><a class="link" href="extreme_dist.html#math_toolkit.dist_ref.dists.extreme_dist.non_member_accessors">Non-member
124           Accessors</a>
125         </h5>
126 <p>
127           All the <a class="link" href="../nmp.html" title="Non-Member Properties">usual non-member accessor
128           functions</a> that are generic to all distributions are supported:
129           <a class="link" href="../nmp.html#math_toolkit.dist_ref.nmp.cdf">Cumulative Distribution Function</a>,
130           <a class="link" href="../nmp.html#math_toolkit.dist_ref.nmp.pdf">Probability Density Function</a>,
131           <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>,
132           <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>,
133           <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>,
134           <a class="link" href="../nmp.html#math_toolkit.dist_ref.nmp.sd">standard deviation</a>,
135           <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>,
136           <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>.
137         </p>
138 <p>
139           The domain of the random parameter is [-&#8734;, +&#8734;].
140         </p>
141 <h5>
142 <a name="math_toolkit.dist_ref.dists.extreme_dist.h2"></a>
143           <span class="phrase"><a name="math_toolkit.dist_ref.dists.extreme_dist.accuracy"></a></span><a class="link" href="extreme_dist.html#math_toolkit.dist_ref.dists.extreme_dist.accuracy">Accuracy</a>
144         </h5>
145 <p>
146           The extreme value distribution is implemented in terms of the standard
147           library <code class="computeroutput"><span class="identifier">exp</span></code> and <code class="computeroutput"><span class="identifier">log</span></code> functions and as such should have
148           very low error rates.
149         </p>
150 <h5>
151 <a name="math_toolkit.dist_ref.dists.extreme_dist.h3"></a>
152           <span class="phrase"><a name="math_toolkit.dist_ref.dists.extreme_dist.implementation"></a></span><a class="link" href="extreme_dist.html#math_toolkit.dist_ref.dists.extreme_dist.implementation">Implementation</a>
153         </h5>
154 <p>
155           In the following table: <span class="emphasis"><em>a</em></span> is the location parameter,
156           <span class="emphasis"><em>b</em></span> is the scale parameter, <span class="emphasis"><em>x</em></span> is
157           the random variate, <span class="emphasis"><em>p</em></span> is the probability and <span class="emphasis"><em>q
158           = 1-p</em></span>.
159         </p>
160 <div class="informaltable"><table class="table">
161 <colgroup>
162 <col>
163 <col>
164 </colgroup>
165 <thead><tr>
166 <th>
167                   <p>
168                     Function
169                   </p>
170                 </th>
171 <th>
172                   <p>
173                     Implementation Notes
174                   </p>
175                 </th>
176 </tr></thead>
177 <tbody>
178 <tr>
179 <td>
180                   <p>
181                     pdf
182                   </p>
183                 </td>
184 <td>
185                   <p>
186                     Using the relation: pdf = exp((a-x)/b) * exp(-exp((a-x)/b)) /
187                     b
188                   </p>
189                 </td>
190 </tr>
191 <tr>
192 <td>
193                   <p>
194                     cdf
195                   </p>
196                 </td>
197 <td>
198                   <p>
199                     Using the relation: p = exp(-exp((a-x)/b))
200                   </p>
201                 </td>
202 </tr>
203 <tr>
204 <td>
205                   <p>
206                     cdf complement
207                   </p>
208                 </td>
209 <td>
210                   <p>
211                     Using the relation: q = -expm1(-exp((a-x)/b))
212                   </p>
213                 </td>
214 </tr>
215 <tr>
216 <td>
217                   <p>
218                     quantile
219                   </p>
220                 </td>
221 <td>
222                   <p>
223                     Using the relation: a - log(-log(p)) * b
224                   </p>
225                 </td>
226 </tr>
227 <tr>
228 <td>
229                   <p>
230                     quantile from the complement
231                   </p>
232                 </td>
233 <td>
234                   <p>
235                     Using the relation: a - log(-log1p(-q)) * b
236                   </p>
237                 </td>
238 </tr>
239 <tr>
240 <td>
241                   <p>
242                     mean
243                   </p>
244                 </td>
245 <td>
246                   <p>
247                     a + <a href="http://en.wikipedia.org/wiki/Euler-Mascheroni_constant" target="_top">Euler-Mascheroni-constant</a>
248                     * b
249                   </p>
250                 </td>
251 </tr>
252 <tr>
253 <td>
254                   <p>
255                     standard deviation
256                   </p>
257                 </td>
258 <td>
259                   <p>
260                     pi * b / sqrt(6)
261                   </p>
262                 </td>
263 </tr>
264 <tr>
265 <td>
266                   <p>
267                     mode
268                   </p>
269                 </td>
270 <td>
271                   <p>
272                     The same as the location parameter <span class="emphasis"><em>a</em></span>.
273                   </p>
274                 </td>
275 </tr>
276 <tr>
277 <td>
278                   <p>
279                     skewness
280                   </p>
281                 </td>
282 <td>
283                   <p>
284                     12 * sqrt(6) * zeta(3) / pi<sup>3</sup>
285                   </p>
286                 </td>
287 </tr>
288 <tr>
289 <td>
290                   <p>
291                     kurtosis
292                   </p>
293                 </td>
294 <td>
295                   <p>
296                     27 / 5
297                   </p>
298                 </td>
299 </tr>
300 <tr>
301 <td>
302                   <p>
303                     kurtosis excess
304                   </p>
305                 </td>
306 <td>
307                   <p>
308                     kurtosis - 3 or 12 / 5
309                   </p>
310                 </td>
311 </tr>
312 </tbody>
313 </table></div>
314 </div>
315 <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
316 <td align="left"></td>
317 <td align="right"><div class="copyright-footer">Copyright &#169; 2006-2010, 2012-2014 Nikhar Agrawal,
318       Anton Bikineev, Paul A. Bristow, Marco Guazzone, Christopher Kormanyos, Hubert
319       Holin, Bruno Lalande, John Maddock, Jeremy Murphy, Johan R&#229;de, Gautam Sewani,
320       Benjamin Sobotta, Thijs van den Berg, Daryle Walker and Xiaogang Zhang<p>
321         Distributed under the Boost Software License, Version 1.0. (See accompanying
322         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>)
323       </p>
324 </div></td>
325 </tr></table>
326 <hr>
327 <div class="spirit-nav">
328 <a accesskey="p" href="exp_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="f_dist.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
329 </div>
330 </body>
331 </html>