extreme_value.qbk 3.9 KB

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