]>
Commit | Line | Data |
---|---|---|
1 | [section:extreme_dist Extreme Value Distribution] | |
2 | ||
3 | ``#include <boost/math/distributions/extreme.hpp>`` | |
4 | ||
5 | template <class RealType = double, | |
6 | class ``__Policy`` = ``__policy_class`` > | |
7 | class extreme_value_distribution; | |
8 | ||
9 | typedef extreme_value_distribution<> extreme_value; | |
10 | ||
11 | template <class RealType, class ``__Policy``> | |
12 | class extreme_value_distribution | |
13 | { | |
14 | public: | |
15 | typedef RealType value_type; | |
16 | ||
17 | extreme_value_distribution(RealType location = 0, RealType scale = 1); | |
18 | ||
19 | RealType scale()const; | |
20 | RealType location()const; | |
21 | }; | |
22 | ||
23 | There are various | |
24 | [@http://mathworld.wolfram.com/ExtremeValueDistribution.html extreme value distributions] | |
25 | : this implementation represents the maximum case, | |
26 | and is variously known as a Fisher-Tippett distribution, | |
27 | a log-Weibull distribution or a Gumbel distribution. | |
28 | ||
29 | Extreme value theory is important for assessing risk for highly unusual events, | |
30 | such as 100-year floods. | |
31 | ||
32 | More information can be found on the | |
33 | [@http://www.itl.nist.gov/div898/handbook/eda/section3/eda366g.htm NIST], | |
34 | [@http://en.wikipedia.org/wiki/Extreme_value_distribution Wikipedia], | |
35 | [@http://mathworld.wolfram.com/ExtremeValueDistribution.html Mathworld], | |
36 | and [@http://en.wikipedia.org/wiki/Extreme_value_theory Extreme value theory] | |
37 | websites. | |
38 | ||
39 | The relationship of the types of extreme value distributions, of which this is but one, is | |
40 | discussed by | |
41 | [@http://www.worldscibooks.com/mathematics/p191.html Extreme Value Distributions, Theory and Applications | |
42 | Samuel Kotz & Saralees Nadarajah]. | |
43 | ||
44 | The distribution has a PDF given by: | |
45 | ||
46 | f(x) = (1/scale) e[super -(x-location)/scale] e[super -e[super -(x-location)/scale]] | |
47 | ||
48 | Which in the standard case (scale = 1, location = 0) reduces to: | |
49 | ||
50 | f(x) = e[super -x]e[super -e[super -x]] | |
51 | ||
52 | The following graph illustrates how the PDF varies with the location parameter: | |
53 | ||
54 | [graph extreme_value_pdf1] | |
55 | ||
56 | And this graph illustrates how the PDF varies with the shape parameter: | |
57 | ||
58 | [graph extreme_value_pdf2] | |
59 | ||
60 | [h4 Member Functions] | |
61 | ||
62 | extreme_value_distribution(RealType location = 0, RealType scale = 1); | |
63 | ||
64 | Constructs an Extreme Value distribution with the specified location and scale | |
65 | parameters. | |
66 | ||
67 | Requires `scale > 0`, otherwise calls __domain_error. | |
68 | ||
69 | RealType location()const; | |
70 | ||
71 | Returns the location parameter of the distribution. | |
72 | ||
73 | RealType scale()const; | |
74 | ||
75 | Returns the scale parameter of the distribution. | |
76 | ||
77 | [h4 Non-member Accessors] | |
78 | ||
79 | All the [link math_toolkit.dist_ref.nmp usual non-member accessor functions] | |
80 | that are generic to all distributions are supported: __usual_accessors. | |
81 | ||
82 | The domain of the random parameter is \[-[infin], +[infin]\]. | |
83 | ||
84 | [h4 Accuracy] | |
85 | ||
86 | The extreme value distribution is implemented in terms of the | |
87 | standard library `exp` and `log` functions and as such should have very low | |
88 | error rates. | |
89 | ||
90 | [h4 Implementation] | |
91 | ||
92 | In the following table: | |
93 | /a/ is the location parameter, /b/ is the scale parameter, | |
94 | /x/ is the random variate, /p/ is the probability and /q = 1-p/. | |
95 | ||
96 | [table | |
97 | [[Function][Implementation Notes]] | |
98 | [[pdf][Using the relation: pdf = exp((a-x)/b) * exp(-exp((a-x)/b)) / b ]] | |
99 | [[cdf][Using the relation: p = exp(-exp((a-x)/b)) ]] | |
100 | [[cdf complement][Using the relation: q = -expm1(-exp((a-x)/b)) ]] | |
101 | [[quantile][Using the relation: a - log(-log(p)) * b]] | |
102 | [[quantile from the complement][Using the relation: a - log(-log1p(-q)) * b]] | |
103 | [[mean][a + [@http://en.wikipedia.org/wiki/Euler-Mascheroni_constant Euler-Mascheroni-constant] * b]] | |
104 | [[standard deviation][pi * b / sqrt(6)]] | |
105 | [[mode][The same as the location parameter /a/.]] | |
106 | [[skewness][12 * sqrt(6) * zeta(3) / pi[super 3] ]] | |
107 | [[kurtosis][27 / 5]] | |
108 | [[kurtosis excess][kurtosis - 3 or 12 / 5]] | |
109 | ] | |
110 | ||
111 | [endsect][/section:extreme_dist Extreme Value] | |
112 | ||
113 | [/ extreme_value.qbk | |
114 | Copyright 2006 John Maddock and Paul A. Bristow. | |
115 | Distributed under the Boost Software License, Version 1.0. | |
116 | (See accompanying file LICENSE_1_0.txt or copy at | |
117 | http://www.boost.org/LICENSE_1_0.txt). | |
118 | ] | |
119 |