• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
26The [@http://en.wikipedia.org/wiki/Poisson_distribution Poisson distribution]
27is a well-known statistical discrete distribution.
28It expresses the probability of a number of events
29(or failures, arrivals, occurrences ...)
30occurring in a fixed period of time,
31provided these events occur with a known mean rate [lambda]
32(events/time), and are independent of the time since the last event.
33
34The distribution was discovered by Sim[eacute]on-Denis Poisson (1781 to 1840).
35
36It has the Probability Mass Function:
37
38[equation poisson_ref1]
39
40for k events, with an expected number of events [lambda].
41
42The 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
52Constructs a poisson distribution with mean /mean/.
53
54   RealType mean()const;
55
56Returns the /mean/ of this distribution.
57
58[h4 Non-member Accessors]
59
60All the [link math_toolkit.dist_ref.nmp usual non-member accessor functions] that are generic to all
61distributions are supported: __usual_accessors.
62
63The domain of the random variable is \[0, [infin]\].
64
65[h4 Accuracy]
66
67The Poisson distribution is implemented in terms of the
68incomplete gamma functions __gamma_p and __gamma_q
69and as such should have low error rates: but refer to the documentation
70of those functions for more information.
71The quantile and its complement use the inverse gamma functions
72and are therefore probably slightly less accurate: this is because the
73inverse gamma functions are implemented using an iterative method with a
74lower tolerance to avoid excessive computation.
75
76[h4 Implementation]
77
78In the following table [lambda] 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[endsect] [/section:poisson_dist Poisson]
96
97[/ poisson.qbk
98  Copyright 2006 John Maddock and Paul A. Bristow.
99  Distributed under the Boost Software License, Version 1.0.
100  (See accompanying file LICENSE_1_0.txt or copy at
101  http://www.boost.org/LICENSE_1_0.txt).
102]
103
104
105