Imported Upstream version 1.72.0
[platform/upstream/boost.git] / libs / math / doc / html / math_toolkit / dist_ref / dists / binomial_dist.html
1 <html>
2 <head>
3 <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
4 <title>Binomial 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="beta_dist.html" title="Beta Distribution">
10 <link rel="next" href="cauchy_dist.html" title="Cauchy-Lorentz 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="beta_dist.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="cauchy_dist.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.binomial_dist"></a><a class="link" href="binomial_dist.html" title="Binomial Distribution">Binomial
28         Distribution</a>
29 </h4></div></div></div>
30 <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">binomial</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span></pre>
31 <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>
32
33 <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>
34           <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>
35 <span class="keyword">class</span> <span class="identifier">binomial_distribution</span><span class="special">;</span>
36
37 <span class="keyword">typedef</span> <span class="identifier">binomial_distribution</span><span class="special">&lt;&gt;</span> <span class="identifier">binomial</span><span class="special">;</span>
38
39 <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>
40 <span class="keyword">class</span> <span class="identifier">binomial_distribution</span>
41 <span class="special">{</span>
42 <span class="keyword">public</span><span class="special">:</span>
43    <span class="keyword">typedef</span> <span class="identifier">RealType</span>  <span class="identifier">value_type</span><span class="special">;</span>
44    <span class="keyword">typedef</span> <span class="identifier">Policy</span>    <span class="identifier">policy_type</span><span class="special">;</span>
45
46    <span class="keyword">static</span> <span class="keyword">const</span> <span class="emphasis"><em>unspecified-type</em></span> <span class="identifier">clopper_pearson_exact_interval</span><span class="special">;</span>
47    <span class="keyword">static</span> <span class="keyword">const</span> <span class="emphasis"><em>unspecified-type</em></span> <span class="identifier">jeffreys_prior_interval</span><span class="special">;</span>
48
49    <span class="comment">// construct:</span>
50    <span class="identifier">binomial_distribution</span><span class="special">(</span><span class="identifier">RealType</span> <span class="identifier">n</span><span class="special">,</span> <span class="identifier">RealType</span> <span class="identifier">p</span><span class="special">);</span>
51
52    <span class="comment">// parameter access::</span>
53    <span class="identifier">RealType</span> <span class="identifier">success_fraction</span><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span>
54    <span class="identifier">RealType</span> <span class="identifier">trials</span><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span>
55
56    <span class="comment">// Bounds on success fraction:</span>
57    <span class="keyword">static</span> <span class="identifier">RealType</span> <span class="identifier">find_lower_bound_on_p</span><span class="special">(</span>
58       <span class="identifier">RealType</span> <span class="identifier">trials</span><span class="special">,</span>
59       <span class="identifier">RealType</span> <span class="identifier">successes</span><span class="special">,</span>
60       <span class="identifier">RealType</span> <span class="identifier">probability</span><span class="special">,</span>
61       <span class="emphasis"><em>unspecified-type</em></span> <span class="identifier">method</span> <span class="special">=</span> <span class="identifier">clopper_pearson_exact_interval</span><span class="special">);</span>
62    <span class="keyword">static</span> <span class="identifier">RealType</span> <span class="identifier">find_upper_bound_on_p</span><span class="special">(</span>
63       <span class="identifier">RealType</span> <span class="identifier">trials</span><span class="special">,</span>
64       <span class="identifier">RealType</span> <span class="identifier">successes</span><span class="special">,</span>
65       <span class="identifier">RealType</span> <span class="identifier">probability</span><span class="special">,</span>
66       <span class="emphasis"><em>unspecified-type</em></span> <span class="identifier">method</span> <span class="special">=</span> <span class="identifier">clopper_pearson_exact_interval</span><span class="special">);</span>
67
68    <span class="comment">// estimate min/max number of trials:</span>
69    <span class="keyword">static</span> <span class="identifier">RealType</span> <span class="identifier">find_minimum_number_of_trials</span><span class="special">(</span>
70       <span class="identifier">RealType</span> <span class="identifier">k</span><span class="special">,</span>     <span class="comment">// number of events</span>
71       <span class="identifier">RealType</span> <span class="identifier">p</span><span class="special">,</span>     <span class="comment">// success fraction</span>
72       <span class="identifier">RealType</span> <span class="identifier">alpha</span><span class="special">);</span> <span class="comment">// risk level</span>
73
74    <span class="keyword">static</span> <span class="identifier">RealType</span> <span class="identifier">find_maximum_number_of_trials</span><span class="special">(</span>
75       <span class="identifier">RealType</span> <span class="identifier">k</span><span class="special">,</span>     <span class="comment">// number of events</span>
76       <span class="identifier">RealType</span> <span class="identifier">p</span><span class="special">,</span>     <span class="comment">// success fraction</span>
77       <span class="identifier">RealType</span> <span class="identifier">alpha</span><span class="special">);</span> <span class="comment">// risk level</span>
78 <span class="special">};</span>
79
80 <span class="special">}}</span> <span class="comment">// namespaces</span>
81 </pre>
82 <p>
83           The class type <code class="computeroutput"><span class="identifier">binomial_distribution</span></code>
84           represents a <a href="http://mathworld.wolfram.com/BinomialDistribution.html" target="_top">binomial
85           distribution</a>: it is used when there are exactly two mutually exclusive
86           outcomes of a trial. These outcomes are labelled "success" and
87           "failure". The <a class="link" href="binomial_dist.html" title="Binomial Distribution">Binomial
88           Distribution</a> is used to obtain the probability of observing k successes
89           in N trials, with the probability of success on a single trial denoted
90           by p. The binomial distribution assumes that p is fixed for all trials.
91         </p>
92 <div class="note"><table border="0" summary="Note">
93 <tr>
94 <td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../../../../../../doc/src/images/note.png"></td>
95 <th align="left">Note</th>
96 </tr>
97 <tr><td align="left" valign="top"><p>
98             The random variable for the binomial distribution is the number of successes,
99             (the number of trials is a fixed property of the distribution) whereas
100             for the negative binomial, the random variable is the number of trials,
101             for a fixed number of successes.
102           </p></td></tr>
103 </table></div>
104 <p>
105           The PDF for the binomial distribution is given by:
106         </p>
107 <div class="blockquote"><blockquote class="blockquote"><p>
108             <span class="inlinemediaobject"><img src="../../../../equations/binomial_ref2.svg"></span>
109
110           </p></blockquote></div>
111 <p>
112           The following two graphs illustrate how the PDF changes depending upon
113           the distributions parameters, first we'll keep the success fraction <span class="emphasis"><em>p</em></span>
114           fixed at 0.5, and vary the sample size:
115         </p>
116 <div class="blockquote"><blockquote class="blockquote"><p>
117             <span class="inlinemediaobject"><img src="../../../../graphs/binomial_pdf_1.svg" align="middle"></span>
118
119           </p></blockquote></div>
120 <p>
121           Alternatively, we can keep the sample size fixed at N=20 and vary the success
122           fraction <span class="emphasis"><em>p</em></span>:
123         </p>
124 <div class="blockquote"><blockquote class="blockquote"><p>
125             <span class="inlinemediaobject"><img src="../../../../graphs/binomial_pdf_2.svg" align="middle"></span>
126
127           </p></blockquote></div>
128 <div class="caution"><table border="0" summary="Caution">
129 <tr>
130 <td rowspan="2" align="center" valign="top" width="25"><img alt="[Caution]" src="../../../../../../../doc/src/images/caution.png"></td>
131 <th align="left">Caution</th>
132 </tr>
133 <tr><td align="left" valign="top">
134 <p>
135             The Binomial distribution is a discrete distribution: internally, functions
136             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
137             are continuous functions, but in reality the results returned from these
138             functions only have meaning if an integer value is provided for the random
139             variate argument.
140           </p>
141 <p>
142             The quantile function will by default return an integer result that has
143             been <span class="emphasis"><em>rounded outwards</em></span>. That is to say lower quantiles
144             (where the probability is less than 0.5) are rounded downward, and upper
145             quantiles (where the probability is greater than 0.5) are rounded upwards.
146             This behaviour ensures that if an X% quantile is requested, then <span class="emphasis"><em>at
147             least</em></span> the requested coverage will be present in the central
148             region, and <span class="emphasis"><em>no more than</em></span> the requested coverage
149             will be present in the tails.
150           </p>
151 <p>
152             This behaviour can be changed so that the quantile functions are rounded
153             differently, or even return a real-valued result using <a class="link" href="../../pol_overview.html" title="Policy Overview">Policies</a>.
154             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
155             Quantiles of Discrete Distributions</a> before using the quantile
156             function on the Binomial distribution. The <a class="link" href="../../pol_ref/discrete_quant_ref.html" title="Discrete Quantile Policies">reference
157             docs</a> describe how to change the rounding policy for these distributions.
158           </p>
159 </td></tr>
160 </table></div>
161 <h5>
162 <a name="math_toolkit.dist_ref.dists.binomial_dist.h0"></a>
163           <span class="phrase"><a name="math_toolkit.dist_ref.dists.binomial_dist.member_functions"></a></span><a class="link" href="binomial_dist.html#math_toolkit.dist_ref.dists.binomial_dist.member_functions">Member
164           Functions</a>
165         </h5>
166 <h6>
167 <a name="math_toolkit.dist_ref.dists.binomial_dist.h1"></a>
168           <span class="phrase"><a name="math_toolkit.dist_ref.dists.binomial_dist.construct"></a></span><a class="link" href="binomial_dist.html#math_toolkit.dist_ref.dists.binomial_dist.construct">Construct</a>
169         </h6>
170 <pre class="programlisting"><span class="identifier">binomial_distribution</span><span class="special">(</span><span class="identifier">RealType</span> <span class="identifier">n</span><span class="special">,</span> <span class="identifier">RealType</span> <span class="identifier">p</span><span class="special">);</span>
171 </pre>
172 <p>
173           Constructor: <span class="emphasis"><em>n</em></span> is the total number of trials, <span class="emphasis"><em>p</em></span>
174           is the probability of success of a single trial.
175         </p>
176 <p>
177           Requires <code class="computeroutput"><span class="number">0</span> <span class="special">&lt;=</span>
178           <span class="identifier">p</span> <span class="special">&lt;=</span>
179           <span class="number">1</span></code>, and <code class="computeroutput"><span class="identifier">n</span>
180           <span class="special">&gt;=</span> <span class="number">0</span></code>,
181           otherwise calls <a class="link" href="../../error_handling.html#math_toolkit.error_handling.domain_error">domain_error</a>.
182         </p>
183 <h6>
184 <a name="math_toolkit.dist_ref.dists.binomial_dist.h2"></a>
185           <span class="phrase"><a name="math_toolkit.dist_ref.dists.binomial_dist.accessors"></a></span><a class="link" href="binomial_dist.html#math_toolkit.dist_ref.dists.binomial_dist.accessors">Accessors</a>
186         </h6>
187 <pre class="programlisting"><span class="identifier">RealType</span> <span class="identifier">success_fraction</span><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span>
188 </pre>
189 <p>
190           Returns the parameter <span class="emphasis"><em>p</em></span> from which this distribution
191           was constructed.
192         </p>
193 <pre class="programlisting"><span class="identifier">RealType</span> <span class="identifier">trials</span><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span>
194 </pre>
195 <p>
196           Returns the parameter <span class="emphasis"><em>n</em></span> from which this distribution
197           was constructed.
198         </p>
199 <h6>
200 <a name="math_toolkit.dist_ref.dists.binomial_dist.h3"></a>
201           <span class="phrase"><a name="math_toolkit.dist_ref.dists.binomial_dist.lower_bound_on_the_success_fract"></a></span><a class="link" href="binomial_dist.html#math_toolkit.dist_ref.dists.binomial_dist.lower_bound_on_the_success_fract">Lower
202           Bound on the Success Fraction</a>
203         </h6>
204 <pre class="programlisting"><span class="keyword">static</span> <span class="identifier">RealType</span> <span class="identifier">find_lower_bound_on_p</span><span class="special">(</span>
205    <span class="identifier">RealType</span> <span class="identifier">trials</span><span class="special">,</span>
206    <span class="identifier">RealType</span> <span class="identifier">successes</span><span class="special">,</span>
207    <span class="identifier">RealType</span> <span class="identifier">alpha</span><span class="special">,</span>
208    <span class="emphasis"><em>unspecified-type</em></span> <span class="identifier">method</span> <span class="special">=</span> <span class="identifier">clopper_pearson_exact_interval</span><span class="special">);</span>
209 </pre>
210 <p>
211           Returns a lower bound on the success fraction:
212         </p>
213 <div class="variablelist">
214 <p class="title"><b></b></p>
215 <dl class="variablelist">
216 <dt><span class="term">trials</span></dt>
217 <dd><p>
218                 The total number of trials conducted.
219               </p></dd>
220 <dt><span class="term">successes</span></dt>
221 <dd><p>
222                 The number of successes that occurred.
223               </p></dd>
224 <dt><span class="term">alpha</span></dt>
225 <dd><p>
226                 The largest acceptable probability that the true value of the success
227                 fraction is <span class="bold"><strong>less than</strong></span> the value
228                 returned.
229               </p></dd>
230 <dt><span class="term">method</span></dt>
231 <dd><p>
232                 An optional parameter that specifies the method to be used to compute
233                 the interval (See below).
234               </p></dd>
235 </dl>
236 </div>
237 <p>
238           For example, if you observe <span class="emphasis"><em>k</em></span> successes from <span class="emphasis"><em>n</em></span>
239           trials the best estimate for the success fraction is simply <span class="emphasis"><em>k/n</em></span>,
240           but if you want to be 95% sure that the true value is <span class="bold"><strong>greater
241           than</strong></span> some value, <span class="emphasis"><em>p<sub>min</sub></em></span>, then:
242         </p>
243 <pre class="programlisting"><span class="identifier">p</span><sub>min</sub> <span class="special">=</span> <span class="identifier">binomial_distribution</span><span class="special">&lt;</span><span class="identifier">RealType</span><span class="special">&gt;::</span><span class="identifier">find_lower_bound_on_p</span><span class="special">(</span><span class="identifier">n</span><span class="special">,</span> <span class="identifier">k</span><span class="special">,</span> <span class="number">0.05</span><span class="special">);</span>
244 </pre>
245 <p>
246           <a class="link" href="../../stat_tut/weg/binom_eg/binom_conf.html" title="Calculating Confidence Limits on the Frequency of Occurrence for a Binomial Distribution">See worked
247           example.</a>
248         </p>
249 <p>
250           There are currently two possible values available for the <span class="emphasis"><em>method</em></span>
251           optional parameter: <span class="emphasis"><em>clopper_pearson_exact_interval</em></span>
252           or <span class="emphasis"><em>jeffreys_prior_interval</em></span>. These constants are both
253           members of class template <code class="computeroutput"><span class="identifier">binomial_distribution</span></code>,
254           so usage is for example:
255         </p>
256 <pre class="programlisting"><span class="identifier">p</span> <span class="special">=</span> <span class="identifier">binomial_distribution</span><span class="special">&lt;</span><span class="identifier">RealType</span><span class="special">&gt;::</span><span class="identifier">find_lower_bound_on_p</span><span class="special">(</span>
257     <span class="identifier">n</span><span class="special">,</span> <span class="identifier">k</span><span class="special">,</span> <span class="number">0.05</span><span class="special">,</span> <span class="identifier">binomial_distribution</span><span class="special">&lt;</span><span class="identifier">RealType</span><span class="special">&gt;::</span><span class="identifier">jeffreys_prior_interval</span><span class="special">);</span>
258 </pre>
259 <p>
260           The default method if this parameter is not specified is the Clopper Pearson
261           "exact" interval. This produces an interval that guarantees at
262           least <code class="computeroutput"><span class="number">100</span><span class="special">(</span><span class="number">1</span><span class="special">-</span><span class="identifier">alpha</span><span class="special">)%</span></code> coverage, but which is known to be overly
263           conservative, sometimes producing intervals with much greater than the
264           requested coverage.
265         </p>
266 <p>
267           The alternative calculation method produces a non-informative Jeffreys
268           Prior interval. It produces <code class="computeroutput"><span class="number">100</span><span class="special">(</span><span class="number">1</span><span class="special">-</span><span class="identifier">alpha</span><span class="special">)%</span></code>
269           coverage only <span class="emphasis"><em>in the average case</em></span>, though is typically
270           very close to the requested coverage level. It is one of the main methods
271           of calculation recommended in the review by Brown, Cai and DasGupta.
272         </p>
273 <p>
274           Please note that the "textbook" calculation method using a normal
275           approximation (the Wald interval) is deliberately not provided: it is known
276           to produce consistently poor results, even when the sample size is surprisingly
277           large. Refer to Brown, Cai and DasGupta for a full explanation. Many other
278           methods of calculation are available, and may be more appropriate for specific
279           situations. Unfortunately there appears to be no consensus amongst statisticians
280           as to which is "best": refer to the discussion at the end of
281           Brown, Cai and DasGupta for examples.
282         </p>
283 <p>
284           The two methods provided here were chosen principally because they can
285           be used for both one and two sided intervals. See also:
286         </p>
287 <p>
288           Lawrence D. Brown, T. Tony Cai and Anirban DasGupta (2001), Interval Estimation
289           for a Binomial Proportion, Statistical Science, Vol. 16, No. 2, 101-133.
290         </p>
291 <p>
292           T. Tony Cai (2005), One-sided confidence intervals in discrete distributions,
293           Journal of Statistical Planning and Inference 131, 63-88.
294         </p>
295 <p>
296           Agresti, A. and Coull, B. A. (1998). Approximate is better than "exact"
297           for interval estimation of binomial proportions. Amer. Statist. 52 119-126.
298         </p>
299 <p>
300           Clopper, C. J. and Pearson, E. S. (1934). The use of confidence or fiducial
301           limits illustrated in the case of the binomial. Biometrika 26 404-413.
302         </p>
303 <h6>
304 <a name="math_toolkit.dist_ref.dists.binomial_dist.h4"></a>
305           <span class="phrase"><a name="math_toolkit.dist_ref.dists.binomial_dist.upper_bound_on_the_success_fract"></a></span><a class="link" href="binomial_dist.html#math_toolkit.dist_ref.dists.binomial_dist.upper_bound_on_the_success_fract">Upper
306           Bound on the Success Fraction</a>
307         </h6>
308 <pre class="programlisting"><span class="keyword">static</span> <span class="identifier">RealType</span> <span class="identifier">find_upper_bound_on_p</span><span class="special">(</span>
309    <span class="identifier">RealType</span> <span class="identifier">trials</span><span class="special">,</span>
310    <span class="identifier">RealType</span> <span class="identifier">successes</span><span class="special">,</span>
311    <span class="identifier">RealType</span> <span class="identifier">alpha</span><span class="special">,</span>
312    <span class="emphasis"><em>unspecified-type</em></span> <span class="identifier">method</span> <span class="special">=</span> <span class="identifier">clopper_pearson_exact_interval</span><span class="special">);</span>
313 </pre>
314 <p>
315           Returns an upper bound on the success fraction:
316         </p>
317 <div class="variablelist">
318 <p class="title"><b></b></p>
319 <dl class="variablelist">
320 <dt><span class="term">trials</span></dt>
321 <dd><p>
322                 The total number of trials conducted.
323               </p></dd>
324 <dt><span class="term">successes</span></dt>
325 <dd><p>
326                 The number of successes that occurred.
327               </p></dd>
328 <dt><span class="term">alpha</span></dt>
329 <dd><p>
330                 The largest acceptable probability that the true value of the success
331                 fraction is <span class="bold"><strong>greater than</strong></span> the value
332                 returned.
333               </p></dd>
334 <dt><span class="term">method</span></dt>
335 <dd><p>
336                 An optional parameter that specifies the method to be used to compute
337                 the interval. Refer to the documentation for <code class="computeroutput"><span class="identifier">find_upper_bound_on_p</span></code>
338                 above for the meaning of the method options.
339               </p></dd>
340 </dl>
341 </div>
342 <p>
343           For example, if you observe <span class="emphasis"><em>k</em></span> successes from <span class="emphasis"><em>n</em></span>
344           trials the best estimate for the success fraction is simply <span class="emphasis"><em>k/n</em></span>,
345           but if you want to be 95% sure that the true value is <span class="bold"><strong>less
346           than</strong></span> some value, <span class="emphasis"><em>p<sub>max</sub></em></span>, then:
347         </p>
348 <pre class="programlisting"><span class="identifier">p</span><sub>max</sub> <span class="special">=</span> <span class="identifier">binomial_distribution</span><span class="special">&lt;</span><span class="identifier">RealType</span><span class="special">&gt;::</span><span class="identifier">find_upper_bound_on_p</span><span class="special">(</span><span class="identifier">n</span><span class="special">,</span> <span class="identifier">k</span><span class="special">,</span> <span class="number">0.05</span><span class="special">);</span>
349 </pre>
350 <p>
351           <a class="link" href="../../stat_tut/weg/binom_eg/binom_conf.html" title="Calculating Confidence Limits on the Frequency of Occurrence for a Binomial Distribution">See worked
352           example.</a>
353         </p>
354 <div class="note"><table border="0" summary="Note">
355 <tr>
356 <td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../../../../../../doc/src/images/note.png"></td>
357 <th align="left">Note</th>
358 </tr>
359 <tr><td align="left" valign="top">
360 <p>
361             In order to obtain a two sided bound on the success fraction, you call
362             both <code class="computeroutput"><span class="identifier">find_lower_bound_on_p</span></code>
363             <span class="bold"><strong>and</strong></span> <code class="computeroutput"><span class="identifier">find_upper_bound_on_p</span></code>
364             each with the same arguments.
365           </p>
366 <p>
367             If the desired risk level that the true success fraction lies outside
368             the bounds is &#945;, then you pass &#945;/2 to these functions.
369           </p>
370 <p>
371             So for example a two sided 95% confidence interval would be obtained
372             by passing &#945; = 0.025 to each of the functions.
373           </p>
374 <p>
375             <a class="link" href="../../stat_tut/weg/binom_eg/binom_conf.html" title="Calculating Confidence Limits on the Frequency of Occurrence for a Binomial Distribution">See worked
376             example.</a>
377           </p>
378 </td></tr>
379 </table></div>
380 <h6>
381 <a name="math_toolkit.dist_ref.dists.binomial_dist.h5"></a>
382           <span class="phrase"><a name="math_toolkit.dist_ref.dists.binomial_dist.estimating_the_number_of_trials_"></a></span><a class="link" href="binomial_dist.html#math_toolkit.dist_ref.dists.binomial_dist.estimating_the_number_of_trials_">Estimating
383           the Number of Trials Required for a Certain Number of Successes</a>
384         </h6>
385 <pre class="programlisting"><span class="keyword">static</span> <span class="identifier">RealType</span> <span class="identifier">find_minimum_number_of_trials</span><span class="special">(</span>
386    <span class="identifier">RealType</span> <span class="identifier">k</span><span class="special">,</span>     <span class="comment">// number of events</span>
387    <span class="identifier">RealType</span> <span class="identifier">p</span><span class="special">,</span>     <span class="comment">// success fraction</span>
388    <span class="identifier">RealType</span> <span class="identifier">alpha</span><span class="special">);</span> <span class="comment">// probability threshold</span>
389 </pre>
390 <p>
391           This function estimates the minimum number of trials required to ensure
392           that more than k events is observed with a level of risk <span class="emphasis"><em>alpha</em></span>
393           that k or fewer events occur.
394         </p>
395 <div class="variablelist">
396 <p class="title"><b></b></p>
397 <dl class="variablelist">
398 <dt><span class="term">k</span></dt>
399 <dd><p>
400                 The number of success observed.
401               </p></dd>
402 <dt><span class="term">p</span></dt>
403 <dd><p>
404                 The probability of success for each trial.
405               </p></dd>
406 <dt><span class="term">alpha</span></dt>
407 <dd><p>
408                 The maximum acceptable probability that k events or fewer will be
409                 observed.
410               </p></dd>
411 </dl>
412 </div>
413 <p>
414           For example:
415         </p>
416 <pre class="programlisting"><span class="identifier">binomial_distribution</span><span class="special">&lt;</span><span class="identifier">RealType</span><span class="special">&gt;::</span><span class="identifier">find_number_of_trials</span><span class="special">(</span><span class="number">10</span><span class="special">,</span> <span class="number">0.5</span><span class="special">,</span> <span class="number">0.05</span><span class="special">);</span>
417 </pre>
418 <p>
419           Returns the smallest number of trials we must conduct to be 95% sure of
420           seeing 10 events that occur with frequency one half.
421         </p>
422 <h6>
423 <a name="math_toolkit.dist_ref.dists.binomial_dist.h6"></a>
424           <span class="phrase"><a name="math_toolkit.dist_ref.dists.binomial_dist.estimating_the_maximum_number_of"></a></span><a class="link" href="binomial_dist.html#math_toolkit.dist_ref.dists.binomial_dist.estimating_the_maximum_number_of">Estimating
425           the Maximum Number of Trials to Ensure no more than a Certain Number of
426           Successes</a>
427         </h6>
428 <pre class="programlisting"><span class="keyword">static</span> <span class="identifier">RealType</span> <span class="identifier">find_maximum_number_of_trials</span><span class="special">(</span>
429    <span class="identifier">RealType</span> <span class="identifier">k</span><span class="special">,</span>     <span class="comment">// number of events</span>
430    <span class="identifier">RealType</span> <span class="identifier">p</span><span class="special">,</span>     <span class="comment">// success fraction</span>
431    <span class="identifier">RealType</span> <span class="identifier">alpha</span><span class="special">);</span> <span class="comment">// probability threshold</span>
432 </pre>
433 <p>
434           This function estimates the maximum number of trials we can conduct to
435           ensure that k successes or fewer are observed, with a risk <span class="emphasis"><em>alpha</em></span>
436           that more than k occur.
437         </p>
438 <div class="variablelist">
439 <p class="title"><b></b></p>
440 <dl class="variablelist">
441 <dt><span class="term">k</span></dt>
442 <dd><p>
443                 The number of success observed.
444               </p></dd>
445 <dt><span class="term">p</span></dt>
446 <dd><p>
447                 The probability of success for each trial.
448               </p></dd>
449 <dt><span class="term">alpha</span></dt>
450 <dd><p>
451                 The maximum acceptable probability that more than k events will be
452                 observed.
453               </p></dd>
454 </dl>
455 </div>
456 <p>
457           For example:
458         </p>
459 <pre class="programlisting"><span class="identifier">binomial_distribution</span><span class="special">&lt;</span><span class="identifier">RealType</span><span class="special">&gt;::</span><span class="identifier">find_maximum_number_of_trials</span><span class="special">(</span><span class="number">0</span><span class="special">,</span> <span class="number">1e-6</span><span class="special">,</span> <span class="number">0.05</span><span class="special">);</span>
460 </pre>
461 <p>
462           Returns the largest number of trials we can conduct and still be 95% certain
463           of not observing any events that occur with one in a million frequency.
464           This is typically used in failure analysis.
465         </p>
466 <p>
467           <a class="link" href="../../stat_tut/weg/binom_eg/binom_size_eg.html" title="Estimating Sample Sizes for a Binomial Distribution.">See Worked
468           Example.</a>
469         </p>
470 <h5>
471 <a name="math_toolkit.dist_ref.dists.binomial_dist.h7"></a>
472           <span class="phrase"><a name="math_toolkit.dist_ref.dists.binomial_dist.non_member_accessors"></a></span><a class="link" href="binomial_dist.html#math_toolkit.dist_ref.dists.binomial_dist.non_member_accessors">Non-member
473           Accessors</a>
474         </h5>
475 <p>
476           All the <a class="link" href="../nmp.html" title="Non-Member Properties">usual non-member accessor
477           functions</a> that are generic to all distributions are supported:
478           <a class="link" href="../nmp.html#math_toolkit.dist_ref.nmp.cdf">Cumulative Distribution Function</a>,
479           <a class="link" href="../nmp.html#math_toolkit.dist_ref.nmp.pdf">Probability Density Function</a>,
480           <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>,
481           <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>,
482           <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>,
483           <a class="link" href="../nmp.html#math_toolkit.dist_ref.nmp.sd">standard deviation</a>,
484           <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>,
485           <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>.
486         </p>
487 <p>
488           The domain for the random variable <span class="emphasis"><em>k</em></span> is <code class="computeroutput"><span class="number">0</span> <span class="special">&lt;=</span> <span class="identifier">k</span> <span class="special">&lt;=</span> <span class="identifier">N</span></code>, otherwise a <a class="link" href="../../error_handling.html#math_toolkit.error_handling.domain_error">domain_error</a>
489           is returned.
490         </p>
491 <p>
492           It's worth taking a moment to define what these accessors actually mean
493           in the context of this distribution:
494         </p>
495 <div class="table">
496 <a name="math_toolkit.dist_ref.dists.binomial_dist.meaning_of_the_non_member_access"></a><p class="title"><b>Table&#160;5.1.&#160;Meaning of the non-member accessors</b></p>
497 <div class="table-contents"><table class="table" summary="Meaning of the non-member accessors">
498 <colgroup>
499 <col>
500 <col>
501 </colgroup>
502 <thead><tr>
503 <th>
504                   <p>
505                     Function
506                   </p>
507                 </th>
508 <th>
509                   <p>
510                     Meaning
511                   </p>
512                 </th>
513 </tr></thead>
514 <tbody>
515 <tr>
516 <td>
517                   <p>
518                     <a class="link" href="../nmp.html#math_toolkit.dist_ref.nmp.pdf">Probability Density
519                     Function</a>
520                   </p>
521                 </td>
522 <td>
523                   <p>
524                     The probability of obtaining <span class="bold"><strong>exactly k
525                     successes</strong></span> from n trials with success fraction p. For
526                     example:
527                   </p>
528                   <p>
529                     <code class="computeroutput"><span class="identifier">pdf</span><span class="special">(</span><span class="identifier">binomial</span><span class="special">(</span><span class="identifier">n</span><span class="special">,</span>
530                     <span class="identifier">p</span><span class="special">),</span>
531                     <span class="identifier">k</span><span class="special">)</span></code>
532                   </p>
533                 </td>
534 </tr>
535 <tr>
536 <td>
537                   <p>
538                     <a class="link" href="../nmp.html#math_toolkit.dist_ref.nmp.cdf">Cumulative Distribution
539                     Function</a>
540                   </p>
541                 </td>
542 <td>
543                   <p>
544                     The probability of obtaining <span class="bold"><strong>k successes
545                     or fewer</strong></span> from n trials with success fraction p. For
546                     example:
547                   </p>
548                   <p>
549                     <code class="computeroutput"><span class="identifier">cdf</span><span class="special">(</span><span class="identifier">binomial</span><span class="special">(</span><span class="identifier">n</span><span class="special">,</span>
550                     <span class="identifier">p</span><span class="special">),</span>
551                     <span class="identifier">k</span><span class="special">)</span></code>
552                   </p>
553                 </td>
554 </tr>
555 <tr>
556 <td>
557                   <p>
558                     <a class="link" href="../nmp.html#math_toolkit.dist_ref.nmp.ccdf">Complement of
559                     the Cumulative Distribution Function</a>
560                   </p>
561                 </td>
562 <td>
563                   <p>
564                     The probability of obtaining <span class="bold"><strong>more than
565                     k successes</strong></span> from n trials with success fraction p.
566                     For example:
567                   </p>
568                   <p>
569                     <code class="computeroutput"><span class="identifier">cdf</span><span class="special">(</span><span class="identifier">complement</span><span class="special">(</span><span class="identifier">binomial</span><span class="special">(</span><span class="identifier">n</span><span class="special">,</span>
570                     <span class="identifier">p</span><span class="special">),</span>
571                     <span class="identifier">k</span><span class="special">))</span></code>
572                   </p>
573                 </td>
574 </tr>
575 <tr>
576 <td>
577                   <p>
578                     <a class="link" href="../nmp.html#math_toolkit.dist_ref.nmp.quantile">Quantile</a>
579                   </p>
580                 </td>
581 <td>
582                   <p>
583                     Given a binomial distribution with <span class="emphasis"><em>n</em></span> trials,
584                     success fraction <span class="emphasis"><em>p</em></span> and probability <span class="emphasis"><em>P</em></span>,
585                     finds the largest number of successes <span class="emphasis"><em>k</em></span>
586                     whose CDF is less than <span class="emphasis"><em>P</em></span>. It is strongly
587                     recommended that you read the tutorial <a class="link" href="../../pol_tutorial/understand_dis_quant.html" title="Understanding Quantiles of Discrete Distributions">Understanding
588                     Quantiles of Discrete Distributions</a> before using the quantile
589                     function.
590                   </p>
591                 </td>
592 </tr>
593 <tr>
594 <td>
595                   <p>
596                     <a class="link" href="../nmp.html#math_toolkit.dist_ref.nmp.quantile_c">Quantile
597                     from the complement of the probability</a>
598                   </p>
599                 </td>
600 <td>
601                   <p>
602                     Given a binomial distribution with <span class="emphasis"><em>n</em></span> trials,
603                     success fraction <span class="emphasis"><em>p</em></span> and probability <span class="emphasis"><em>Q</em></span>,
604                     finds the smallest number of successes <span class="emphasis"><em>k</em></span>
605                     whose CDF is greater than <span class="emphasis"><em>1-Q</em></span>. It is strongly
606                     recommended that you read the tutorial <a class="link" href="../../pol_tutorial/understand_dis_quant.html" title="Understanding Quantiles of Discrete Distributions">Understanding
607                     Quantiles of Discrete Distributions</a> before using the quantile
608                     function.
609                   </p>
610                 </td>
611 </tr>
612 </tbody>
613 </table></div>
614 </div>
615 <br class="table-break"><h5>
616 <a name="math_toolkit.dist_ref.dists.binomial_dist.h8"></a>
617           <span class="phrase"><a name="math_toolkit.dist_ref.dists.binomial_dist.examples"></a></span><a class="link" href="binomial_dist.html#math_toolkit.dist_ref.dists.binomial_dist.examples">Examples</a>
618         </h5>
619 <p>
620           Various <a class="link" href="../../stat_tut/weg/binom_eg.html" title="Binomial Distribution Examples">worked examples</a>
621           are available illustrating the use of the binomial distribution.
622         </p>
623 <h5>
624 <a name="math_toolkit.dist_ref.dists.binomial_dist.h9"></a>
625           <span class="phrase"><a name="math_toolkit.dist_ref.dists.binomial_dist.accuracy"></a></span><a class="link" href="binomial_dist.html#math_toolkit.dist_ref.dists.binomial_dist.accuracy">Accuracy</a>
626         </h5>
627 <p>
628           This distribution is implemented using the incomplete beta functions <a class="link" href="../../sf_beta/ibeta_function.html" title="Incomplete Beta Functions">ibeta</a> and <a class="link" href="../../sf_beta/ibeta_function.html" title="Incomplete Beta Functions">ibetac</a>,
629           please refer to these functions for information on accuracy.
630         </p>
631 <h5>
632 <a name="math_toolkit.dist_ref.dists.binomial_dist.h10"></a>
633           <span class="phrase"><a name="math_toolkit.dist_ref.dists.binomial_dist.implementation"></a></span><a class="link" href="binomial_dist.html#math_toolkit.dist_ref.dists.binomial_dist.implementation">Implementation</a>
634         </h5>
635 <p>
636           In the following table <span class="emphasis"><em>p</em></span> is the probability that one
637           trial will be successful (the success fraction), <span class="emphasis"><em>n</em></span>
638           is the number of trials, <span class="emphasis"><em>k</em></span> is the number of successes,
639           <span class="emphasis"><em>p</em></span> is the probability and <span class="emphasis"><em>q = 1-p</em></span>.
640         </p>
641 <div class="informaltable"><table class="table">
642 <colgroup>
643 <col>
644 <col>
645 </colgroup>
646 <thead><tr>
647 <th>
648                   <p>
649                     Function
650                   </p>
651                 </th>
652 <th>
653                   <p>
654                     Implementation Notes
655                   </p>
656                 </th>
657 </tr></thead>
658 <tbody>
659 <tr>
660 <td>
661                   <p>
662                     pdf
663                   </p>
664                 </td>
665 <td>
666                   <p>
667                     Implementation is in terms of <a class="link" href="../../sf_beta/beta_derivative.html" title="Derivative of the Incomplete Beta Function">ibeta_derivative</a>:
668                     if <sub>n</sub>C<sub>k </sub> is the binomial coefficient of a and b, then we have:
669                   </p>
670                   <div class="blockquote"><blockquote class="blockquote"><p>
671                       <span class="inlinemediaobject"><img src="../../../../equations/binomial_ref1.svg"></span>
672
673                     </p></blockquote></div>
674                   <p>
675                     Which can be evaluated as <code class="computeroutput"><span class="identifier">ibeta_derivative</span><span class="special">(</span><span class="identifier">k</span><span class="special">+</span><span class="number">1</span><span class="special">,</span> <span class="identifier">n</span><span class="special">-</span><span class="identifier">k</span><span class="special">+</span><span class="number">1</span><span class="special">,</span> <span class="identifier">p</span><span class="special">)</span> <span class="special">/</span>
676                     <span class="special">(</span><span class="identifier">n</span><span class="special">+</span><span class="number">1</span><span class="special">)</span></code>
677                   </p>
678                   <p>
679                     The function <a class="link" href="../../sf_beta/beta_derivative.html" title="Derivative of the Incomplete Beta Function">ibeta_derivative</a>
680                     is used here, since it has already been optimised for the lowest
681                     possible error - indeed this is really just a thin wrapper around
682                     part of the internals of the incomplete beta function.
683                   </p>
684                   <p>
685                     There are also various special cases: refer to the code for details.
686                   </p>
687                 </td>
688 </tr>
689 <tr>
690 <td>
691                   <p>
692                     cdf
693                   </p>
694                 </td>
695 <td>
696                   <p>
697                     Using the relation:
698                   </p>
699 <pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"><span class="identifier">p</span> <span class="special">=</span> <span class="identifier">I</span><span class="special">[</span><span class="identifier">sub</span> <span class="number">1</span><span class="special">-</span><span class="identifier">p</span><span class="special">](</span><span class="identifier">n</span> <span class="special">-</span> <span class="identifier">k</span><span class="special">,</span> <span class="identifier">k</span> <span class="special">+</span> <span class="number">1</span><span class="special">)</span>
700   <span class="special">=</span> <span class="number">1</span> <span class="special">-</span> <span class="identifier">I</span><span class="special">[</span><span class="identifier">sub</span> <span class="identifier">p</span><span class="special">](</span><span class="identifier">k</span> <span class="special">+</span> <span class="number">1</span><span class="special">,</span> <span class="identifier">n</span> <span class="special">-</span> <span class="identifier">k</span><span class="special">)</span>
701   <span class="special">=</span> <a class="link" href="../../sf_beta/ibeta_function.html" title="Incomplete Beta Functions">ibetac</a><span class="special">(</span><span class="identifier">k</span> <span class="special">+</span> <span class="number">1</span><span class="special">,</span> <span class="identifier">n</span> <span class="special">-</span> <span class="identifier">k</span><span class="special">,</span> <span class="identifier">p</span><span class="special">)</span></pre>
702                   <p>
703                     There are also various special cases: refer to the code for details.
704                   </p>
705                 </td>
706 </tr>
707 <tr>
708 <td>
709                   <p>
710                     cdf complement
711                   </p>
712                 </td>
713 <td>
714                   <p>
715                     Using the relation: q = <a class="link" href="../../sf_beta/ibeta_function.html" title="Incomplete Beta Functions">ibeta</a>(k
716                     + 1, n - k, p)
717                   </p>
718                   <p>
719                     There are also various special cases: refer to the code for details.
720                   </p>
721                 </td>
722 </tr>
723 <tr>
724 <td>
725                   <p>
726                     quantile
727                   </p>
728                 </td>
729 <td>
730                   <p>
731                     Since the cdf is non-linear in variate <span class="emphasis"><em>k</em></span>
732                     none of the inverse incomplete beta functions can be used here.
733                     Instead the quantile is found numerically using a derivative
734                     free method (<a class="link" href="../../roots_noderiv/TOMS748.html" title="Algorithm TOMS 748: Alefeld, Potra and Shi: Enclosing zeros of continuous functions">TOMS
735                     748 algorithm</a>).
736                   </p>
737                 </td>
738 </tr>
739 <tr>
740 <td>
741                   <p>
742                     quantile from the complement
743                   </p>
744                 </td>
745 <td>
746                   <p>
747                     Found numerically as above.
748                   </p>
749                 </td>
750 </tr>
751 <tr>
752 <td>
753                   <p>
754                     mean
755                   </p>
756                 </td>
757 <td>
758                   <p>
759                     <code class="computeroutput"><span class="identifier">p</span> <span class="special">*</span>
760                     <span class="identifier">n</span></code>
761                   </p>
762                 </td>
763 </tr>
764 <tr>
765 <td>
766                   <p>
767                     variance
768                   </p>
769                 </td>
770 <td>
771                   <p>
772                     <code class="computeroutput"><span class="identifier">p</span> <span class="special">*</span>
773                     <span class="identifier">n</span> <span class="special">*</span>
774                     <span class="special">(</span><span class="number">1</span><span class="special">-</span><span class="identifier">p</span><span class="special">)</span></code>
775                   </p>
776                 </td>
777 </tr>
778 <tr>
779 <td>
780                   <p>
781                     mode
782                   </p>
783                 </td>
784 <td>
785                   <p>
786                     <code class="computeroutput"><span class="identifier">floor</span><span class="special">(</span><span class="identifier">p</span> <span class="special">*</span>
787                     <span class="special">(</span><span class="identifier">n</span>
788                     <span class="special">+</span> <span class="number">1</span><span class="special">))</span></code>
789                   </p>
790                 </td>
791 </tr>
792 <tr>
793 <td>
794                   <p>
795                     skewness
796                   </p>
797                 </td>
798 <td>
799                   <p>
800                     <code class="computeroutput"><span class="special">(</span><span class="number">1</span>
801                     <span class="special">-</span> <span class="number">2</span>
802                     <span class="special">*</span> <span class="identifier">p</span><span class="special">)</span> <span class="special">/</span>
803                     <span class="identifier">sqrt</span><span class="special">(</span><span class="identifier">n</span> <span class="special">*</span>
804                     <span class="identifier">p</span> <span class="special">*</span>
805                     <span class="special">(</span><span class="number">1</span>
806                     <span class="special">-</span> <span class="identifier">p</span><span class="special">))</span></code>
807                   </p>
808                 </td>
809 </tr>
810 <tr>
811 <td>
812                   <p>
813                     kurtosis
814                   </p>
815                 </td>
816 <td>
817                   <p>
818                     <code class="computeroutput"><span class="number">3</span> <span class="special">-</span>
819                     <span class="special">(</span><span class="number">6</span>
820                     <span class="special">/</span> <span class="identifier">n</span><span class="special">)</span> <span class="special">+</span>
821                     <span class="special">(</span><span class="number">1</span>
822                     <span class="special">/</span> <span class="special">(</span><span class="identifier">n</span> <span class="special">*</span>
823                     <span class="identifier">p</span> <span class="special">*</span>
824                     <span class="special">(</span><span class="number">1</span>
825                     <span class="special">-</span> <span class="identifier">p</span><span class="special">)))</span></code>
826                   </p>
827                 </td>
828 </tr>
829 <tr>
830 <td>
831                   <p>
832                     kurtosis excess
833                   </p>
834                 </td>
835 <td>
836                   <p>
837                     <code class="computeroutput"><span class="special">(</span><span class="number">1</span>
838                     <span class="special">-</span> <span class="number">6</span>
839                     <span class="special">*</span> <span class="identifier">p</span>
840                     <span class="special">*</span> <span class="identifier">q</span><span class="special">)</span> <span class="special">/</span>
841                     <span class="special">(</span><span class="identifier">n</span>
842                     <span class="special">*</span> <span class="identifier">p</span>
843                     <span class="special">*</span> <span class="identifier">q</span><span class="special">)</span></code>
844                   </p>
845                 </td>
846 </tr>
847 <tr>
848 <td>
849                   <p>
850                     parameter estimation
851                   </p>
852                 </td>
853 <td>
854                   <p>
855                     The member functions <code class="computeroutput"><span class="identifier">find_upper_bound_on_p</span></code>
856                     <code class="computeroutput"><span class="identifier">find_lower_bound_on_p</span></code>
857                     and <code class="computeroutput"><span class="identifier">find_number_of_trials</span></code>
858                     are implemented in terms of the inverse incomplete beta functions
859                     <a class="link" href="../../sf_beta/ibeta_inv_function.html" title="The Incomplete Beta Function Inverses">ibetac_inv</a>,
860                     <a class="link" href="../../sf_beta/ibeta_inv_function.html" title="The Incomplete Beta Function Inverses">ibeta_inv</a>,
861                     and <a class="link" href="../../sf_beta/ibeta_inv_function.html" title="The Incomplete Beta Function Inverses">ibetac_invb</a>
862                     respectively
863                   </p>
864                 </td>
865 </tr>
866 </tbody>
867 </table></div>
868 <h5>
869 <a name="math_toolkit.dist_ref.dists.binomial_dist.h11"></a>
870           <span class="phrase"><a name="math_toolkit.dist_ref.dists.binomial_dist.references"></a></span><a class="link" href="binomial_dist.html#math_toolkit.dist_ref.dists.binomial_dist.references">References</a>
871         </h5>
872 <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
873 <li class="listitem">
874               <a href="http://mathworld.wolfram.com/BinomialDistribution.html" target="_top">Weisstein,
875               Eric W. "Binomial Distribution." From MathWorld--A Wolfram
876               Web Resource</a>.
877             </li>
878 <li class="listitem">
879               <a href="http://en.wikipedia.org/wiki/Beta_distribution" target="_top">Wikipedia
880               binomial distribution</a>.
881             </li>
882 <li class="listitem">
883               <a href="http://www.itl.nist.gov/div898/handbook/eda/section3/eda366i.htm" target="_top">NIST
884               Explorary Data Analysis</a>.
885             </li>
886 </ul></div>
887 </div>
888 <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
889 <td align="left"></td>
890 <td align="right"><div class="copyright-footer">Copyright &#169; 2006-2019 Nikhar
891       Agrawal, Anton Bikineev, Paul A. Bristow, Marco Guazzone, Christopher Kormanyos,
892       Hubert Holin, Bruno Lalande, John Maddock, Jeremy Murphy, Matthew Pulver, Johan
893       R&#229;de, Gautam Sewani, Benjamin Sobotta, Nicholas Thompson, Thijs van den Berg,
894       Daryle Walker and Xiaogang Zhang<p>
895         Distributed under the Boost Software License, Version 1.0. (See accompanying
896         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>)
897       </p>
898 </div></td>
899 </tr></table>
900 <hr>
901 <div class="spirit-nav">
902 <a accesskey="p" href="beta_dist.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="cauchy_dist.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
903 </div>
904 </body>
905 </html>