]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | [section:poisson_dist Poisson Distribution] |
2 | ||
3 | ``#include <boost/math/distributions/poisson.hpp>`` | |
4 | ||
5 | namespace boost { namespace math { | |
6 | ||
7 | template <class RealType = double, | |
8 | class ``__Policy`` = ``__policy_class`` > | |
9 | class poisson_distribution; | |
10 | ||
11 | typedef poisson_distribution<> poisson; | |
12 | ||
13 | template <class RealType, class ``__Policy``> | |
14 | class poisson_distribution | |
15 | { | |
16 | public: | |
17 | typedef RealType value_type; | |
18 | typedef Policy policy_type; | |
19 | ||
20 | poisson_distribution(RealType mean = 1); // Constructor. | |
21 | RealType mean()const; // Accessor. | |
22 | } | |
23 | ||
24 | }} // namespaces boost::math | |
25 | ||
26 | The [@http://en.wikipedia.org/wiki/Poisson_distribution Poisson distribution] | |
27 | is a well-known statistical discrete distribution. | |
28 | It expresses the probability of a number of events | |
29 | (or failures, arrivals, occurrences ...) | |
30 | occurring in a fixed period of time, | |
31 | provided these events occur with a known mean rate [lambda][space] | |
32 | (events/time), and are independent of the time since the last event. | |
33 | ||
34 | The distribution was discovered by Sim__eacute on-Denis Poisson (1781 to 1840). | |
35 | ||
36 | It has the Probability Mass Function: | |
37 | ||
38 | [equation poisson_ref1] | |
39 | ||
40 | for k events, with an expected number of events [lambda]. | |
41 | ||
42 | The following graph illustrates how the PDF varies with the parameter [lambda]: | |
43 | ||
44 | [graph poisson_pdf_1] | |
45 | ||
46 | [discrete_quantile_warning Poisson] | |
47 | ||
48 | [h4 Member Functions] | |
49 | ||
50 | poisson_distribution(RealType mean = 1); | |
51 | ||
52 | Constructs a poisson distribution with mean /mean/. | |
53 | ||
54 | RealType mean()const; | |
55 | ||
56 | Returns the /mean/ of this distribution. | |
57 | ||
58 | [h4 Non-member Accessors] | |
59 | ||
60 | All the [link math_toolkit.dist_ref.nmp usual non-member accessor functions] that are generic to all | |
61 | distributions are supported: __usual_accessors. | |
62 | ||
63 | The domain of the random variable is \[0, [infin]\]. | |
64 | ||
65 | [h4 Accuracy] | |
66 | ||
67 | The Poisson distribution is implemented in terms of the | |
68 | incomplete gamma functions __gamma_p and __gamma_q | |
69 | and as such should have low error rates: but refer to the documentation | |
70 | of those functions for more information. | |
71 | The quantile and its complement use the inverse gamma functions | |
72 | and are therefore probably slightly less accurate: this is because the | |
73 | inverse gamma functions are implemented using an iterative method with a | |
74 | lower tolerance to avoid excessive computation. | |
75 | ||
76 | [h4 Implementation] | |
77 | ||
78 | In the following table [lambda][space] is the mean of the distribution, | |
79 | /k/ is the random variable, /p/ is the probability and /q = 1-p/. | |
80 | ||
81 | [table | |
82 | [[Function][Implementation Notes]] | |
83 | [[pdf][Using the relation: pdf = e[super -[lambda]] [lambda][super k] \/ k! ]] | |
84 | [[cdf][Using the relation: p = [Gamma](k+1, [lambda]) \/ k! = __gamma_q(k+1, [lambda])]] | |
85 | [[cdf complement][Using the relation: q = __gamma_p(k+1, [lambda]) ]] | |
86 | [[quantile][Using the relation: k = __gamma_q_inva([lambda], p) - 1]] | |
87 | [[quantile from the complement][Using the relation: k = __gamma_p_inva([lambda], q) - 1]] | |
88 | [[mean][[lambda]]] | |
89 | [[mode][ floor ([lambda]) or [floorlr[lambda]] ]] | |
90 | [[skewness][1/[radic][lambda]]] | |
91 | [[kurtosis][3 + 1/[lambda]]] | |
92 | [[kurtosis excess][1/[lambda]]] | |
93 | ] | |
94 | ||
95 | [/ poisson.qbk | |
96 | Copyright 2006 John Maddock and Paul A. Bristow. | |
97 | Distributed under the Boost Software License, Version 1.0. | |
98 | (See accompanying file LICENSE_1_0.txt or copy at | |
99 | http://www.boost.org/LICENSE_1_0.txt). | |
100 | ] | |
101 | ||
102 | [endsect][/section:poisson_dist Poisson] | |
103 |