exponential.qbk 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. [section:exp_dist Exponential Distribution]
  2. ``#include <boost/math/distributions/exponential.hpp>``
  3. template <class RealType = double,
  4. class ``__Policy`` = ``__policy_class`` >
  5. class exponential_distribution;
  6. typedef exponential_distribution<> exponential;
  7. template <class RealType, class ``__Policy``>
  8. class exponential_distribution
  9. {
  10. public:
  11. typedef RealType value_type;
  12. typedef Policy policy_type;
  13. exponential_distribution(RealType lambda = 1);
  14. RealType lambda()const;
  15. };
  16. The [@http://en.wikipedia.org/wiki/Exponential_distribution exponential distribution]
  17. is a [@http://en.wikipedia.org/wiki/Probability_distribution continuous probability distribution]
  18. with PDF:
  19. [equation exponential_dist_ref1]
  20. It is often used to model the time between independent
  21. events that happen at a constant average rate.
  22. The following graph shows how the distribution changes for different
  23. values of the rate parameter lambda:
  24. [graph exponential_pdf]
  25. [h4 Member Functions]
  26. exponential_distribution(RealType lambda = 1);
  27. Constructs an
  28. [@http://en.wikipedia.org/wiki/Exponential_distribution Exponential distribution]
  29. with parameter /lambda/.
  30. Lambda is defined as the reciprocal of the scale parameter.
  31. Requires lambda > 0, otherwise calls __domain_error.
  32. RealType lambda()const;
  33. Accessor function returns the lambda parameter of the distribution.
  34. [h4 Non-member Accessors]
  35. All the [link math_toolkit.dist_ref.nmp usual non-member accessor functions]
  36. that are generic to all distributions are supported: __usual_accessors.
  37. The domain of the random variable is \[0, +[infin]\].
  38. [h4 Accuracy]
  39. The exponential distribution is implemented in terms of the
  40. standard library functions `exp`, `log`, `log1p` and `expm1`
  41. and as such should have very low error rates.
  42. [h4 Implementation]
  43. In the following table [lambda] is the parameter lambda of the distribution,
  44. /x/ is the random variate, /p/ is the probability and /q = 1-p/.
  45. [table
  46. [[Function][Implementation Notes]]
  47. [[pdf][Using the relation: pdf = [lambda] * exp(-[lambda] * x) ]]
  48. [[cdf][Using the relation: p = 1 - exp(-x * [lambda]) = -expm1(-x * [lambda]) ]]
  49. [[cdf complement][Using the relation: q = exp(-x * [lambda]) ]]
  50. [[quantile][Using the relation: x = -log(1-p) / [lambda] = -log1p(-p) / [lambda]]]
  51. [[quantile from the complement][Using the relation: x = -log(q) / [lambda]]]
  52. [[mean][1/[lambda]]]
  53. [[standard deviation][1/[lambda]]]
  54. [[mode][0]]
  55. [[skewness][2]]
  56. [[kurtosis][9]]
  57. [[kurtosis excess][6]]
  58. ]
  59. [h4 references]
  60. * [@http://mathworld.wolfram.com/ExponentialDistribution.html Weisstein, Eric W. "Exponential Distribution." From MathWorld--A Wolfram Web Resource]
  61. * [@http://documents.wolfram.com/calccenter/Functions/ListsMatrices/Statistics/ExponentialDistribution.html Wolfram Mathematica calculator]
  62. * [@http://www.itl.nist.gov/div898/handbook/eda/section3/eda3667.htm NIST Exploratory Data Analysis]
  63. * [@http://en.wikipedia.org/wiki/Exponential_distribution Wikipedia Exponential distribution]
  64. (See also the reference documentation for the related __extreme_distrib.)
  65. *
  66. [@http://www.worldscibooks.com/mathematics/p191.html Extreme Value Distributions, Theory and Applications
  67. Samuel Kotz & Saralees Nadarajah]
  68. discuss the relationship of the types of extreme value distributions.
  69. [endsect] [/section:exp_dist Exponential]
  70. [/ exponential.qbk
  71. Copyright 2006 John Maddock and Paul A. Bristow.
  72. Distributed under the Boost Software License, Version 1.0.
  73. (See accompanying file LICENSE_1_0.txt or copy at
  74. http://www.boost.org/LICENSE_1_0.txt).
  75. ]