Imported Upstream version 1.72.0
[platform/upstream/boost.git] / libs / math / doc / html / math_toolkit / dist_ref / dists / poisson_dist.html
1 <html>
2 <head>
3 <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
4 <title>Poisson Distribution</title>
5 <link rel="stylesheet" href="../../../math.css" type="text/css">
6 <meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
7 <link rel="home" href="../../../index.html" title="Math Toolkit 2.11.0">
8 <link rel="up" href="../dists.html" title="Distributions">
9 <link rel="prev" href="pareto.html" title="Pareto Distribution">
10 <link rel="next" href="rayleigh.html" title="Rayleigh Distribution">
11 </head>
12 <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
13 <table cellpadding="2" width="100%"><tr>
14 <td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../boost.png"></td>
15 <td align="center"><a href="../../../../../../../index.html">Home</a></td>
16 <td align="center"><a href="../../../../../../../libs/libraries.htm">Libraries</a></td>
17 <td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
18 <td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
19 <td align="center"><a href="../../../../../../../more/index.htm">More</a></td>
20 </tr></table>
21 <hr>
22 <div class="spirit-nav">
23 <a accesskey="p" href="pareto.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../dists.html"><img src="../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="rayleigh.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
24 </div>
25 <div class="section">
26 <div class="titlepage"><div><div><h4 class="title">
27 <a name="math_toolkit.dist_ref.dists.poisson_dist"></a><a class="link" href="poisson_dist.html" title="Poisson Distribution">Poisson Distribution</a>
28 </h4></div></div></div>
29 <pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">math</span><span class="special">/</span><span class="identifier">distributions</span><span class="special">/</span><span class="identifier">poisson</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span></pre>
30 <pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">boost</span> <span class="special">{</span> <span class="keyword">namespace</span> <span class="identifier">math</span> <span class="special">{</span>
31
32 <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">RealType</span> <span class="special">=</span> <span class="keyword">double</span><span class="special">,</span>
33           <span class="keyword">class</span> <a class="link" href="../../../policy.html" title="Chapter&#160;20.&#160;Policies: Controlling Precision, Error Handling etc">Policy</a>   <span class="special">=</span> <a class="link" href="../../pol_ref/pol_ref_ref.html" title="Policy Class Reference">policies::policy&lt;&gt;</a> <span class="special">&gt;</span>
34 <span class="keyword">class</span> <span class="identifier">poisson_distribution</span><span class="special">;</span>
35
36 <span class="keyword">typedef</span> <span class="identifier">poisson_distribution</span><span class="special">&lt;&gt;</span> <span class="identifier">poisson</span><span class="special">;</span>
37
38 <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">RealType</span><span class="special">,</span> <span class="keyword">class</span> <a class="link" href="../../../policy.html" title="Chapter&#160;20.&#160;Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">&gt;</span>
39 <span class="keyword">class</span> <span class="identifier">poisson_distribution</span>
40 <span class="special">{</span>
41 <span class="keyword">public</span><span class="special">:</span>
42   <span class="keyword">typedef</span> <span class="identifier">RealType</span> <span class="identifier">value_type</span><span class="special">;</span>
43   <span class="keyword">typedef</span> <span class="identifier">Policy</span>   <span class="identifier">policy_type</span><span class="special">;</span>
44
45   <span class="identifier">poisson_distribution</span><span class="special">(</span><span class="identifier">RealType</span> <span class="identifier">mean</span> <span class="special">=</span> <span class="number">1</span><span class="special">);</span> <span class="comment">// Constructor.</span>
46   <span class="identifier">RealType</span> <span class="identifier">mean</span><span class="special">()</span><span class="keyword">const</span><span class="special">;</span> <span class="comment">// Accessor.</span>
47 <span class="special">}</span>
48
49 <span class="special">}}</span> <span class="comment">// namespaces boost::math</span>
50 </pre>
51 <p>
52           The <a href="http://en.wikipedia.org/wiki/Poisson_distribution" target="_top">Poisson
53           distribution</a> is a well-known statistical discrete distribution.
54           It expresses the probability of a number of events (or failures, arrivals,
55           occurrences ...) occurring in a fixed period of time, provided these events
56           occur with a known mean rate &#955;
57 (events/time), and are independent of the
58           time since the last event.
59         </p>
60 <p>
61           The distribution was discovered by Sim&#233;on-Denis Poisson (1781 to 1840).
62         </p>
63 <p>
64           It has the Probability Mass Function:
65         </p>
66 <div class="blockquote"><blockquote class="blockquote"><p>
67             <span class="inlinemediaobject"><img src="../../../../equations/poisson_ref1.svg"></span>
68
69           </p></blockquote></div>
70 <p>
71           for k events, with an expected number of events &#955;.
72         </p>
73 <p>
74           The following graph illustrates how the PDF varies with the parameter &#955;:
75         </p>
76 <div class="blockquote"><blockquote class="blockquote"><p>
77             <span class="inlinemediaobject"><img src="../../../../graphs/poisson_pdf_1.svg" align="middle"></span>
78
79           </p></blockquote></div>
80 <div class="caution"><table border="0" summary="Caution">
81 <tr>
82 <td rowspan="2" align="center" valign="top" width="25"><img alt="[Caution]" src="../../../../../../../doc/src/images/caution.png"></td>
83 <th align="left">Caution</th>
84 </tr>
85 <tr><td align="left" valign="top">
86 <p>
87             The Poisson distribution is a discrete distribution: internally, functions
88             like the <code class="computeroutput"><span class="identifier">cdf</span></code> and <code class="computeroutput"><span class="identifier">pdf</span></code> are treated "as if" they
89             are continuous functions, but in reality the results returned from these
90             functions only have meaning if an integer value is provided for the random
91             variate argument.
92           </p>
93 <p>
94             The quantile function will by default return an integer result that has
95             been <span class="emphasis"><em>rounded outwards</em></span>. That is to say lower quantiles
96             (where the probability is less than 0.5) are rounded downward, and upper
97             quantiles (where the probability is greater than 0.5) are rounded upwards.
98             This behaviour ensures that if an X% quantile is requested, then <span class="emphasis"><em>at
99             least</em></span> the requested coverage will be present in the central
100             region, and <span class="emphasis"><em>no more than</em></span> the requested coverage
101             will be present in the tails.
102           </p>
103 <p>
104             This behaviour can be changed so that the quantile functions are rounded
105             differently, or even return a real-valued result using <a class="link" href="../../pol_overview.html" title="Policy Overview">Policies</a>.
106             It is strongly recommended that you read the tutorial <a class="link" href="../../pol_tutorial/understand_dis_quant.html" title="Understanding Quantiles of Discrete Distributions">Understanding
107             Quantiles of Discrete Distributions</a> before using the quantile
108             function on the Poisson distribution. The <a class="link" href="../../pol_ref/discrete_quant_ref.html" title="Discrete Quantile Policies">reference
109             docs</a> describe how to change the rounding policy for these distributions.
110           </p>
111 </td></tr>
112 </table></div>
113 <h5>
114 <a name="math_toolkit.dist_ref.dists.poisson_dist.h0"></a>
115           <span class="phrase"><a name="math_toolkit.dist_ref.dists.poisson_dist.member_functions"></a></span><a class="link" href="poisson_dist.html#math_toolkit.dist_ref.dists.poisson_dist.member_functions">Member
116           Functions</a>
117         </h5>
118 <pre class="programlisting"><span class="identifier">poisson_distribution</span><span class="special">(</span><span class="identifier">RealType</span> <span class="identifier">mean</span> <span class="special">=</span> <span class="number">1</span><span class="special">);</span>
119 </pre>
120 <p>
121           Constructs a poisson distribution with mean <span class="emphasis"><em>mean</em></span>.
122         </p>
123 <pre class="programlisting"><span class="identifier">RealType</span> <span class="identifier">mean</span><span class="special">()</span><span class="keyword">const</span><span class="special">;</span>
124 </pre>
125 <p>
126           Returns the <span class="emphasis"><em>mean</em></span> of this distribution.
127         </p>
128 <h5>
129 <a name="math_toolkit.dist_ref.dists.poisson_dist.h1"></a>
130           <span class="phrase"><a name="math_toolkit.dist_ref.dists.poisson_dist.non_member_accessors"></a></span><a class="link" href="poisson_dist.html#math_toolkit.dist_ref.dists.poisson_dist.non_member_accessors">Non-member
131           Accessors</a>
132         </h5>
133 <p>
134           All the <a class="link" href="../nmp.html" title="Non-Member Properties">usual non-member accessor
135           functions</a> that are generic to all distributions are supported:
136           <a class="link" href="../nmp.html#math_toolkit.dist_ref.nmp.cdf">Cumulative Distribution Function</a>,
137           <a class="link" href="../nmp.html#math_toolkit.dist_ref.nmp.pdf">Probability Density Function</a>,
138           <a class="link" href="../nmp.html#math_toolkit.dist_ref.nmp.quantile">Quantile</a>, <a class="link" href="../nmp.html#math_toolkit.dist_ref.nmp.hazard">Hazard Function</a>, <a class="link" href="../nmp.html#math_toolkit.dist_ref.nmp.chf">Cumulative Hazard Function</a>,
139           <a class="link" href="../nmp.html#math_toolkit.dist_ref.nmp.mean">mean</a>, <a class="link" href="../nmp.html#math_toolkit.dist_ref.nmp.median">median</a>,
140           <a class="link" href="../nmp.html#math_toolkit.dist_ref.nmp.mode">mode</a>, <a class="link" href="../nmp.html#math_toolkit.dist_ref.nmp.variance">variance</a>,
141           <a class="link" href="../nmp.html#math_toolkit.dist_ref.nmp.sd">standard deviation</a>,
142           <a class="link" href="../nmp.html#math_toolkit.dist_ref.nmp.skewness">skewness</a>, <a class="link" href="../nmp.html#math_toolkit.dist_ref.nmp.kurtosis">kurtosis</a>, <a class="link" href="../nmp.html#math_toolkit.dist_ref.nmp.kurtosis_excess">kurtosis_excess</a>,
143           <a class="link" href="../nmp.html#math_toolkit.dist_ref.nmp.range">range</a> and <a class="link" href="../nmp.html#math_toolkit.dist_ref.nmp.support">support</a>.
144         </p>
145 <p>
146           The domain of the random variable is [0, &#8734;].
147         </p>
148 <h5>
149 <a name="math_toolkit.dist_ref.dists.poisson_dist.h2"></a>
150           <span class="phrase"><a name="math_toolkit.dist_ref.dists.poisson_dist.accuracy"></a></span><a class="link" href="poisson_dist.html#math_toolkit.dist_ref.dists.poisson_dist.accuracy">Accuracy</a>
151         </h5>
152 <p>
153           The Poisson distribution is implemented in terms of the incomplete gamma
154           functions <a class="link" href="../../sf_gamma/igamma.html" title="Incomplete Gamma Functions">gamma_p</a> and
155           <a class="link" href="../../sf_gamma/igamma.html" title="Incomplete Gamma Functions">gamma_q</a> and as such
156           should have low error rates: but refer to the documentation of those functions
157           for more information. The quantile and its complement use the inverse gamma
158           functions and are therefore probably slightly less accurate: this is because
159           the inverse gamma functions are implemented using an iterative method with
160           a lower tolerance to avoid excessive computation.
161         </p>
162 <h5>
163 <a name="math_toolkit.dist_ref.dists.poisson_dist.h3"></a>
164           <span class="phrase"><a name="math_toolkit.dist_ref.dists.poisson_dist.implementation"></a></span><a class="link" href="poisson_dist.html#math_toolkit.dist_ref.dists.poisson_dist.implementation">Implementation</a>
165         </h5>
166 <p>
167           In the following table &#955; is the mean of the distribution, <span class="emphasis"><em>k</em></span>
168           is the random variable, <span class="emphasis"><em>p</em></span> is the probability and
169           <span class="emphasis"><em>q = 1-p</em></span>.
170         </p>
171 <div class="informaltable"><table class="table">
172 <colgroup>
173 <col>
174 <col>
175 </colgroup>
176 <thead><tr>
177 <th>
178                   <p>
179                     Function
180                   </p>
181                 </th>
182 <th>
183                   <p>
184                     Implementation Notes
185                   </p>
186                 </th>
187 </tr></thead>
188 <tbody>
189 <tr>
190 <td>
191                   <p>
192                     pdf
193                   </p>
194                 </td>
195 <td>
196                   <p>
197                     Using the relation: pdf = e<sup>-&#955;</sup> &#955;<sup>k</sup> / k!
198                   </p>
199                 </td>
200 </tr>
201 <tr>
202 <td>
203                   <p>
204                     cdf
205                   </p>
206                 </td>
207 <td>
208                   <p>
209                     Using the relation: p = &#915;(k+1, &#955;) / k! = <a class="link" href="../../sf_gamma/igamma.html" title="Incomplete Gamma Functions">gamma_q</a>(k+1,
210                     &#955;)
211                   </p>
212                 </td>
213 </tr>
214 <tr>
215 <td>
216                   <p>
217                     cdf complement
218                   </p>
219                 </td>
220 <td>
221                   <p>
222                     Using the relation: q = <a class="link" href="../../sf_gamma/igamma.html" title="Incomplete Gamma Functions">gamma_p</a>(k+1,
223                     &#955;)
224                   </p>
225                 </td>
226 </tr>
227 <tr>
228 <td>
229                   <p>
230                     quantile
231                   </p>
232                 </td>
233 <td>
234                   <p>
235                     Using the relation: k = <a class="link" href="../../sf_gamma/igamma_inv.html" title="Incomplete Gamma Function Inverses">gamma_q_inva</a>(&#955;,
236                     p) - 1
237                   </p>
238                 </td>
239 </tr>
240 <tr>
241 <td>
242                   <p>
243                     quantile from the complement
244                   </p>
245                 </td>
246 <td>
247                   <p>
248                     Using the relation: k = <a class="link" href="../../sf_gamma/igamma_inv.html" title="Incomplete Gamma Function Inverses">gamma_p_inva</a>(&#955;,
249                     q) - 1
250                   </p>
251                 </td>
252 </tr>
253 <tr>
254 <td>
255                   <p>
256                     mean
257                   </p>
258                 </td>
259 <td>
260                   <p>
261                     &#955;
262                   </p>
263                 </td>
264 </tr>
265 <tr>
266 <td>
267                   <p>
268                     mode
269                   </p>
270                 </td>
271 <td>
272                   <p>
273                     floor (&#955;) or &#8970;&#955;&#8971;
274                   </p>
275                 </td>
276 </tr>
277 <tr>
278 <td>
279                   <p>
280                     skewness
281                   </p>
282                 </td>
283 <td>
284                   <p>
285                     1/&#8730;&#955;
286                   </p>
287                 </td>
288 </tr>
289 <tr>
290 <td>
291                   <p>
292                     kurtosis
293                   </p>
294                 </td>
295 <td>
296                   <p>
297                     3 + 1/&#955;
298                   </p>
299                 </td>
300 </tr>
301 <tr>
302 <td>
303                   <p>
304                     kurtosis excess
305                   </p>
306                 </td>
307 <td>
308                   <p>
309                     1/&#955;
310                   </p>
311                 </td>
312 </tr>
313 </tbody>
314 </table></div>
315 </div>
316 <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
317 <td align="left"></td>
318 <td align="right"><div class="copyright-footer">Copyright &#169; 2006-2019 Nikhar
319       Agrawal, Anton Bikineev, Paul A. Bristow, Marco Guazzone, Christopher Kormanyos,
320       Hubert Holin, Bruno Lalande, John Maddock, Jeremy Murphy, Matthew Pulver, Johan
321       R&#229;de, Gautam Sewani, Benjamin Sobotta, Nicholas Thompson, Thijs van den Berg,
322       Daryle Walker and Xiaogang Zhang<p>
323         Distributed under the Boost Software License, Version 1.0. (See accompanying
324         file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
325       </p>
326 </div></td>
327 </tr></table>
328 <hr>
329 <div class="spirit-nav">
330 <a accesskey="p" href="pareto.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../dists.html"><img src="../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="rayleigh.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
331 </div>
332 </body>
333 </html>