File: poisson.qbk

package info (click to toggle)
boost1.88 1.88.0-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 576,932 kB
  • sloc: cpp: 4,149,234; xml: 136,789; ansic: 35,092; python: 33,910; asm: 5,698; sh: 4,604; ada: 1,681; makefile: 1,633; pascal: 1,139; perl: 1,124; sql: 640; yacc: 478; ruby: 271; java: 77; lisp: 24; csh: 6
file content (110 lines) | stat: -rw-r--r-- 3,715 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
[section:poisson_dist Poisson Distribution]

``#include <boost/math/distributions/poisson.hpp>``

  namespace boost { namespace math {
  
  template <class RealType = double, 
            class ``__Policy``   = ``__policy_class`` >
  class poisson_distribution;

  typedef poisson_distribution<> poisson;

  template <class RealType, class ``__Policy``>
  class poisson_distribution
  { 
  public:
    typedef RealType value_type;
    typedef Policy   policy_type;
    
    BOOST_MATH_GPU_ENABLED poisson_distribution(RealType mean = 1); // Constructor.
    BOOST_MATH_GPU_ENABLED RealType mean()const; // Accessor.
  }
   
  }} // namespaces boost::math
   
The [@http://en.wikipedia.org/wiki/Poisson_distribution Poisson distribution]
is a well-known statistical discrete distribution.
It expresses the probability of a number of events
(or failures, arrivals, occurrences ...)
occurring in a fixed period of time,
provided these events occur with a known mean rate [lambda]
(events/time), and are independent of the time since the last event.

The distribution was discovered by Sim[eacute]on-Denis Poisson (1781 to 1840).

It has the Probability Mass Function:

[equation poisson_ref1]

for k events, with an expected number of events [lambda].

The following graph illustrates how the PDF varies with the parameter [lambda]:

[graph poisson_pdf_1]

[discrete_quantile_warning Poisson]

[h4 Member Functions]

   BOOST_MATH_GPU_ENABLED poisson_distribution(RealType mean = 1);
   
Constructs a poisson distribution with mean /mean/.

   BOOST_MATH_GPU_ENABLED RealType mean()const;
   
Returns the /mean/ of this distribution.
   
[h4 Non-member Accessors]

All the [link math_toolkit.dist_ref.nmp usual non-member accessor functions] that are generic to all
distributions are supported: __usual_accessors.
For this distribution all non-member accessor functions are marked with `BOOST_MATH_GPU_ENABLED` and can
be run on both host and device.

The domain of the random variable is \[0, [infin]\].

In this distribution the implementation of `logpdf` is specialized
to improve numerical accuracy.

[h4 Accuracy]

The Poisson distribution is implemented in terms of the 
incomplete gamma functions __gamma_p and __gamma_q 
and as such should have low error rates: but refer to the documentation
of those functions for more information.
The quantile and its complement use the inverse gamma functions
and are therefore probably slightly less accurate: this is because the 
inverse gamma functions are implemented using an iterative method with a 
lower tolerance to avoid excessive computation.

[h4 Implementation]

In the following table [lambda] is the mean of the distribution,
/k/ is the random variable, /p/ is the probability and /q = 1-p/.

[table
[[Function][Implementation Notes]]
[[pdf][Using the relation: pdf = e[super -[lambda]] [lambda][super k] \/ k! ]]
[[logpdf][log(pdf) = -lgamma(k+1) + k*log([lambda]) - [lambda] if k > 0 and [lambda] > 0 ]]
[[cdf][Using the relation: p = [Gamma](k+1, [lambda]) \/ k! = __gamma_q(k+1, [lambda])]]
[[cdf complement][Using the relation: q = __gamma_p(k+1, [lambda]) ]]
[[quantile][Using the relation: k = __gamma_q_inva([lambda], p) - 1]]
[[quantile from the complement][Using the relation: k = __gamma_p_inva([lambda], q) - 1]]
[[mean][[lambda]]]
[[mode][ floor ([lambda]) or [floorlr[lambda]] ]]
[[skewness][1/[radic][lambda]]]
[[kurtosis][3 + 1/[lambda]]]
[[kurtosis excess][1/[lambda]]]
]

[endsect] [/section:poisson_dist Poisson]

[/ poisson.qbk
  Copyright 2006 John Maddock and Paul A. Bristow.
  Distributed under the Boost Software License, Version 1.0.
  (See accompanying file LICENSE_1_0.txt or copy at
  http://www.boost.org/LICENSE_1_0.txt).
]