]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/math/doc/html/math_toolkit/dist_ref/dists/poisson_dist.html
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / math / doc / html / math_toolkit / dist_ref / dists / poisson_dist.html
CommitLineData
7c673cae
FG
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.77.1">
7<link rel="home" href="../../../index.html" title="Math Toolkit 2.5.1">
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;15.&#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;15.&#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; &#160;
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<p>
67 <span class="inlinemediaobject"><img src="../../../../equations/poisson_ref1.svg"></span>
68 </p>
69<p>
70 for k events, with an expected number of events &#955;.
71 </p>
72<p>
73 The following graph illustrates how the PDF varies with the parameter &#955;:
74 </p>
75<p>
76 <span class="inlinemediaobject"><img src="../../../../graphs/poisson_pdf_1.svg" align="middle"></span>
77 </p>
78<div class="caution"><table border="0" summary="Caution">
79<tr>
80<td rowspan="2" align="center" valign="top" width="25"><img alt="[Caution]" src="../../../../../../../doc/src/images/caution.png"></td>
81<th align="left">Caution</th>
82</tr>
83<tr><td align="left" valign="top">
84<p>
85 The Poisson distribution is a discrete distribution: internally, functions
86 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
87 are continuous functions, but in reality the results returned from these
88 functions only have meaning if an integer value is provided for the random
89 variate argument.
90 </p>
91<p>
92 The quantile function will by default return an integer result that has
93 been <span class="emphasis"><em>rounded outwards</em></span>. That is to say lower quantiles
94 (where the probability is less than 0.5) are rounded downward, and upper
95 quantiles (where the probability is greater than 0.5) are rounded upwards.
96 This behaviour ensures that if an X% quantile is requested, then <span class="emphasis"><em>at
97 least</em></span> the requested coverage will be present in the central
98 region, and <span class="emphasis"><em>no more than</em></span> the requested coverage
99 will be present in the tails.
100 </p>
101<p>
102 This behaviour can be changed so that the quantile functions are rounded
103 differently, or even return a real-valued result using <a class="link" href="../../pol_overview.html" title="Policy Overview">Policies</a>.
104 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
105 Quantiles of Discrete Distributions</a> before using the quantile
106 function on the Poisson distribution. The <a class="link" href="../../pol_ref/discrete_quant_ref.html" title="Discrete Quantile Policies">reference
107 docs</a> describe how to change the rounding policy for these distributions.
108 </p>
109</td></tr>
110</table></div>
111<h5>
112<a name="math_toolkit.dist_ref.dists.poisson_dist.h0"></a>
113 <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
114 Functions</a>
115 </h5>
116<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>
117</pre>
118<p>
119 Constructs a poisson distribution with mean <span class="emphasis"><em>mean</em></span>.
120 </p>
121<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>
122</pre>
123<p>
124 Returns the <span class="emphasis"><em>mean</em></span> of this distribution.
125 </p>
126<h5>
127<a name="math_toolkit.dist_ref.dists.poisson_dist.h1"></a>
128 <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
129 Accessors</a>
130 </h5>
131<p>
132 All the <a class="link" href="../nmp.html" title="Non-Member Properties">usual non-member accessor
133 functions</a> that are generic to all distributions are supported:
134 <a class="link" href="../nmp.html#math_toolkit.dist_ref.nmp.cdf">Cumulative Distribution Function</a>,
135 <a class="link" href="../nmp.html#math_toolkit.dist_ref.nmp.pdf">Probability Density Function</a>,
136 <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>,
137 <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>,
138 <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>,
139 <a class="link" href="../nmp.html#math_toolkit.dist_ref.nmp.sd">standard deviation</a>,
140 <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>,
141 <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>.
142 </p>
143<p>
144 The domain of the random variable is [0, &#8734;].
145 </p>
146<h5>
147<a name="math_toolkit.dist_ref.dists.poisson_dist.h2"></a>
148 <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>
149 </h5>
150<p>
151 The Poisson distribution is implemented in terms of the incomplete gamma
152 functions <a class="link" href="../../sf_gamma/igamma.html" title="Incomplete Gamma Functions">gamma_p</a> and
153 <a class="link" href="../../sf_gamma/igamma.html" title="Incomplete Gamma Functions">gamma_q</a> and as such
154 should have low error rates: but refer to the documentation of those functions
155 for more information. The quantile and its complement use the inverse gamma
156 functions and are therefore probably slightly less accurate: this is because
157 the inverse gamma functions are implemented using an iterative method with
158 a lower tolerance to avoid excessive computation.
159 </p>
160<h5>
161<a name="math_toolkit.dist_ref.dists.poisson_dist.h3"></a>
162 <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>
163 </h5>
164<p>
165 In the following table &#955; &#160; is the mean of the distribution, <span class="emphasis"><em>k</em></span>
166 is the random variable, <span class="emphasis"><em>p</em></span> is the probability and
167 <span class="emphasis"><em>q = 1-p</em></span>.
168 </p>
169<div class="informaltable"><table class="table">
170<colgroup>
171<col>
172<col>
173</colgroup>
174<thead><tr>
175<th>
176 <p>
177 Function
178 </p>
179 </th>
180<th>
181 <p>
182 Implementation Notes
183 </p>
184 </th>
185</tr></thead>
186<tbody>
187<tr>
188<td>
189 <p>
190 pdf
191 </p>
192 </td>
193<td>
194 <p>
195 Using the relation: pdf = e<sup>-&#955;</sup> &#955;<sup>k</sup> / k!
196 </p>
197 </td>
198</tr>
199<tr>
200<td>
201 <p>
202 cdf
203 </p>
204 </td>
205<td>
206 <p>
207 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,
208 &#955;)
209 </p>
210 </td>
211</tr>
212<tr>
213<td>
214 <p>
215 cdf complement
216 </p>
217 </td>
218<td>
219 <p>
220 Using the relation: q = <a class="link" href="../../sf_gamma/igamma.html" title="Incomplete Gamma Functions">gamma_p</a>(k+1,
221 &#955;)
222 </p>
223 </td>
224</tr>
225<tr>
226<td>
227 <p>
228 quantile
229 </p>
230 </td>
231<td>
232 <p>
233 Using the relation: k = <a class="link" href="../../sf_gamma/igamma_inv.html" title="Incomplete Gamma Function Inverses">gamma_q_inva</a>(&#955;,
234 p) - 1
235 </p>
236 </td>
237</tr>
238<tr>
239<td>
240 <p>
241 quantile from the complement
242 </p>
243 </td>
244<td>
245 <p>
246 Using the relation: k = <a class="link" href="../../sf_gamma/igamma_inv.html" title="Incomplete Gamma Function Inverses">gamma_p_inva</a>(&#955;,
247 q) - 1
248 </p>
249 </td>
250</tr>
251<tr>
252<td>
253 <p>
254 mean
255 </p>
256 </td>
257<td>
258 <p>
259 &#955;
260 </p>
261 </td>
262</tr>
263<tr>
264<td>
265 <p>
266 mode
267 </p>
268 </td>
269<td>
270 <p>
271 floor (&#955;) or &#8970;&#955;&#8971;
272 </p>
273 </td>
274</tr>
275<tr>
276<td>
277 <p>
278 skewness
279 </p>
280 </td>
281<td>
282 <p>
283 1/&#8730;&#955;
284 </p>
285 </td>
286</tr>
287<tr>
288<td>
289 <p>
290 kurtosis
291 </p>
292 </td>
293<td>
294 <p>
295 3 + 1/&#955;
296 </p>
297 </td>
298</tr>
299<tr>
300<td>
301 <p>
302 kurtosis excess
303 </p>
304 </td>
305<td>
306 <p>
307 1/&#955;
308 </p>
309 </td>
310</tr>
311</tbody>
312</table></div>
313</div>
314<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
315<td align="left"></td>
316<td align="right"><div class="copyright-footer">Copyright &#169; 2006-2010, 2012-2014 Nikhar Agrawal,
317 Anton Bikineev, Paul A. Bristow, Marco Guazzone, Christopher Kormanyos, Hubert
318 Holin, Bruno Lalande, John Maddock, Jeremy Murphy, Johan R&#229;de, Gautam Sewani,
319 Benjamin Sobotta, Thijs van den Berg, Daryle Walker and Xiaogang Zhang<p>
320 Distributed under the Boost Software License, Version 1.0. (See accompanying
321 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>)
322 </p>
323</div></td>
324</tr></table>
325<hr>
326<div class="spirit-nav">
327<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>
328</div>
329</body>
330</html>