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