]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | <html> |
2 | <head> | |
3 | <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII"> | |
4 | <title>Noncentral Beta 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="negative_binomial_dist.html" title="Negative Binomial Distribution"> | |
10 | <link rel="next" href="nc_chi_squared_dist.html" title="Noncentral Chi-Squared 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="negative_binomial_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="nc_chi_squared_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.nc_beta_dist"></a><a class="link" href="nc_beta_dist.html" title="Noncentral Beta Distribution">Noncentral | |
28 | Beta Distribution</a> | |
29 | </h4></div></div></div> | |
30 | <pre class="programlisting"><span class="preprocessor">#include</span> <span class="special"><</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">non_central_beta</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></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"><</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 15. 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<></a> <span class="special">></span> | |
35 | <span class="keyword">class</span> <span class="identifier">non_central_beta_distribution</span><span class="special">;</span> | |
36 | ||
37 | <span class="keyword">typedef</span> <span class="identifier">non_central_beta_distribution</span><span class="special"><></span> <span class="identifier">non_central_beta</span><span class="special">;</span> | |
38 | ||
39 | <span class="keyword">template</span> <span class="special"><</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 15. Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">></span> | |
40 | <span class="keyword">class</span> <span class="identifier">non_central_beta_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="comment">// Constructor:</span> | |
47 | <span class="identifier">non_central_beta_distribution</span><span class="special">(</span><span class="identifier">RealType</span> <span class="identifier">alpha</span><span class="special">,</span> <span class="identifier">RealType</span> <span class="identifier">beta</span><span class="special">,</span> <span class="identifier">RealType</span> <span class="identifier">lambda</span><span class="special">);</span> | |
48 | ||
49 | <span class="comment">// Accessor to shape parameters:</span> | |
50 | <span class="identifier">RealType</span> <span class="identifier">alpha</span><span class="special">()</span><span class="keyword">const</span><span class="special">;</span> | |
51 | <span class="identifier">RealType</span> <span class="identifier">beta</span><span class="special">()</span><span class="keyword">const</span><span class="special">;</span> | |
52 | ||
53 | <span class="comment">// Accessor to non-centrality parameter lambda:</span> | |
54 | <span class="identifier">RealType</span> <span class="identifier">non_centrality</span><span class="special">()</span><span class="keyword">const</span><span class="special">;</span> | |
55 | <span class="special">};</span> | |
56 | ||
57 | <span class="special">}}</span> <span class="comment">// namespaces</span> | |
58 | </pre> | |
59 | <p> | |
60 | The noncentral beta distribution is a generalization of the <a class="link" href="beta_dist.html" title="Beta Distribution">Beta | |
61 | Distribution</a>. | |
62 | </p> | |
63 | <p> | |
64 | It is defined as the ratio X = χ<sub>m</sub><sup>2</sup>(λ) / (χ<sub>m</sub><sup>2</sup>(λ) + χ<sub>n</sub><sup>2</sup>) where χ<sub>m</sub><sup>2</sup>(λ) is a noncentral | |
65 | χ<sup>2</sup> | |
66 | random variable with <span class="emphasis"><em>m</em></span> degrees of freedom, and χ<sub>n</sub><sup>2</sup> | |
67 | is | |
68 | a central χ<sup>2</sup> random variable with <span class="emphasis"><em>n</em></span> degrees of freedom. | |
69 | </p> | |
70 | <p> | |
71 | This gives a PDF that can be expressed as a Poisson mixture of beta distribution | |
72 | PDFs: | |
73 | </p> | |
74 | <p> | |
75 | <span class="inlinemediaobject"><img src="../../../../equations/nc_beta_ref1.svg"></span> | |
76 | </p> | |
77 | <p> | |
78 | where P(i;λ/2) is the discrete Poisson probablity at <span class="emphasis"><em>i</em></span>, | |
79 | with mean λ/2, and I<sub>x</sub><sup>'</sup>(α, β) is the derivative of the incomplete beta function. | |
80 | This leads to the usual form of the CDF as: | |
81 | </p> | |
82 | <p> | |
83 | <span class="inlinemediaobject"><img src="../../../../equations/nc_beta_ref2.svg"></span> | |
84 | </p> | |
85 | <p> | |
86 | The following graph illustrates how the distribution changes for different | |
87 | values of λ: | |
88 | </p> | |
89 | <p> | |
90 | <span class="inlinemediaobject"><img src="../../../../graphs/nc_beta_pdf.svg" align="middle"></span> | |
91 | </p> | |
92 | <h5> | |
93 | <a name="math_toolkit.dist_ref.dists.nc_beta_dist.h0"></a> | |
94 | <span class="phrase"><a name="math_toolkit.dist_ref.dists.nc_beta_dist.member_functions"></a></span><a class="link" href="nc_beta_dist.html#math_toolkit.dist_ref.dists.nc_beta_dist.member_functions">Member | |
95 | Functions</a> | |
96 | </h5> | |
97 | <pre class="programlisting"><span class="identifier">non_central_beta_distribution</span><span class="special">(</span><span class="identifier">RealType</span> <span class="identifier">a</span><span class="special">,</span> <span class="identifier">RealType</span> <span class="identifier">b</span><span class="special">,</span> <span class="identifier">RealType</span> <span class="identifier">lambda</span><span class="special">);</span> | |
98 | </pre> | |
99 | <p> | |
100 | Constructs a noncentral beta distribution with shape parameters <span class="emphasis"><em>a</em></span> | |
101 | and <span class="emphasis"><em>b</em></span> and non-centrality parameter <span class="emphasis"><em>lambda</em></span>. | |
102 | </p> | |
103 | <p> | |
104 | Requires a > 0, b > 0 and lambda >= 0, otherwise calls <a class="link" href="../../error_handling.html#math_toolkit.error_handling.domain_error">domain_error</a>. | |
105 | </p> | |
106 | <pre class="programlisting"><span class="identifier">RealType</span> <span class="identifier">alpha</span><span class="special">()</span><span class="keyword">const</span><span class="special">;</span> | |
107 | </pre> | |
108 | <p> | |
109 | Returns the parameter <span class="emphasis"><em>a</em></span> from which this object was | |
110 | constructed. | |
111 | </p> | |
112 | <pre class="programlisting"><span class="identifier">RealType</span> <span class="identifier">beta</span><span class="special">()</span><span class="keyword">const</span><span class="special">;</span> | |
113 | </pre> | |
114 | <p> | |
115 | Returns the parameter <span class="emphasis"><em>b</em></span> from which this object was | |
116 | constructed. | |
117 | </p> | |
118 | <pre class="programlisting"><span class="identifier">RealType</span> <span class="identifier">non_centrality</span><span class="special">()</span><span class="keyword">const</span><span class="special">;</span> | |
119 | </pre> | |
120 | <p> | |
121 | Returns the parameter <span class="emphasis"><em>lambda</em></span> from which this object | |
122 | was constructed. | |
123 | </p> | |
124 | <h5> | |
125 | <a name="math_toolkit.dist_ref.dists.nc_beta_dist.h1"></a> | |
126 | <span class="phrase"><a name="math_toolkit.dist_ref.dists.nc_beta_dist.non_member_accessors"></a></span><a class="link" href="nc_beta_dist.html#math_toolkit.dist_ref.dists.nc_beta_dist.non_member_accessors">Non-member | |
127 | Accessors</a> | |
128 | </h5> | |
129 | <p> | |
130 | Most of the <a class="link" href="../nmp.html" title="Non-Member Properties">usual non-member | |
131 | accessor functions</a> are supported: <a class="link" href="../nmp.html#math_toolkit.dist_ref.nmp.cdf">Cumulative | |
132 | Distribution Function</a>, <a class="link" href="../nmp.html#math_toolkit.dist_ref.nmp.pdf">Probability | |
133 | Density Function</a>, <a class="link" href="../nmp.html#math_toolkit.dist_ref.nmp.quantile">Quantile</a>, | |
134 | <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.variance">variance</a>, | |
135 | <a class="link" href="../nmp.html#math_toolkit.dist_ref.nmp.sd">standard deviation</a>, | |
136 | <a class="link" href="../nmp.html#math_toolkit.dist_ref.nmp.median">median</a>, <a class="link" href="../nmp.html#math_toolkit.dist_ref.nmp.mode">mode</a>, | |
137 | <a class="link" href="../nmp.html#math_toolkit.dist_ref.nmp.hazard">Hazard Function</a>, | |
138 | <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.range">range</a> and <a class="link" href="../nmp.html#math_toolkit.dist_ref.nmp.support">support</a>. | |
140 | </p> | |
141 | <p> | |
142 | Mean and variance are implemented using hypergeometric pfq functions and | |
143 | relations given in <a href="http://reference.wolfram.com/mathematica/ref/NoncentralBetaDistribution.html" target="_top">Wolfram | |
144 | Noncentral Beta Distribution</a>. | |
145 | </p> | |
146 | <p> | |
147 | However, the following are not currently implemented: <a class="link" href="../nmp.html#math_toolkit.dist_ref.nmp.skewness">skewness</a>, | |
148 | <a class="link" href="../nmp.html#math_toolkit.dist_ref.nmp.kurtosis">kurtosis</a> and | |
149 | <a class="link" href="../nmp.html#math_toolkit.dist_ref.nmp.kurtosis_excess">kurtosis_excess</a>. | |
150 | </p> | |
151 | <p> | |
152 | The domain of the random variable is [0, 1]. | |
153 | </p> | |
154 | <h5> | |
155 | <a name="math_toolkit.dist_ref.dists.nc_beta_dist.h2"></a> | |
156 | <span class="phrase"><a name="math_toolkit.dist_ref.dists.nc_beta_dist.accuracy"></a></span><a class="link" href="nc_beta_dist.html#math_toolkit.dist_ref.dists.nc_beta_dist.accuracy">Accuracy</a> | |
157 | </h5> | |
158 | <p> | |
159 | The following table shows the peak errors (in units of <a href="http://en.wikipedia.org/wiki/Machine_epsilon" target="_top">epsilon</a>) | |
160 | found on various platforms with various floating point types. The failures | |
161 | in the comparison to the <a href="http://www.r-project.org/" target="_top">R Math | |
162 | library</a>, seem to be mostly in the corner cases when the probablity | |
163 | would be very small. Unless otherwise specified any floating-point type | |
164 | that is narrower than the one shown will have <a class="link" href="../../relative_error.html#math_toolkit.relative_error.zero_error">effectively | |
165 | zero error</a>. | |
166 | </p> | |
167 | <div class="table"> | |
168 | <a name="math_toolkit.dist_ref.dists.nc_beta_dist.table_non_central_beta_CDF"></a><p class="title"><b>Table 5.4. Error rates for non central beta CDF</b></p> | |
169 | <div class="table-contents"><table class="table" summary="Error rates for non central beta CDF"> | |
170 | <colgroup> | |
171 | <col> | |
172 | <col> | |
173 | <col> | |
174 | <col> | |
175 | <col> | |
176 | </colgroup> | |
177 | <thead><tr> | |
178 | <th> | |
179 | </th> | |
180 | <th> | |
181 | <p> | |
182 | Microsoft Visual C++ version 12.0<br> Win32<br> double | |
183 | </p> | |
184 | </th> | |
185 | <th> | |
186 | <p> | |
187 | GNU C++ version 5.1.0<br> linux<br> double | |
188 | </p> | |
189 | </th> | |
190 | <th> | |
191 | <p> | |
192 | GNU C++ version 5.1.0<br> linux<br> long double | |
193 | </p> | |
194 | </th> | |
195 | <th> | |
196 | <p> | |
197 | Sun compiler version 0x5130<br> Sun Solaris<br> long double | |
198 | </p> | |
199 | </th> | |
200 | </tr></thead> | |
201 | <tbody> | |
202 | <tr> | |
203 | <td> | |
204 | <p> | |
205 | Non Central Beta, medium parameters | |
206 | </p> | |
207 | </td> | |
208 | <td> | |
209 | <p> | |
210 | <span class="blue">Max = 240ε (Mean = 31ε)</span> | |
211 | </p> | |
212 | </td> | |
213 | <td> | |
214 | <p> | |
215 | <span class="blue">Max = 0.998ε (Mean = 0.0659ε)</span><br> | |
216 | <br> (<span class="emphasis"><em>Rmath 3.0.2:</em></span> <span class="red">Max | |
217 | = 1.46e+26ε (Mean = 3.5e+24ε) <a class="link" href="../../logs_and_tables/logs.html#errors_GNU_C_version_5_1_0_linux_double_non_central_beta_CDF_Rmath_3_0_2_Non_Central_Beta_medium_parameters">And | |
218 | other failures.</a>)</span> | |
219 | </p> | |
220 | </td> | |
221 | <td> | |
222 | <p> | |
223 | <span class="blue">Max = 825ε (Mean = 27.4ε)</span> | |
224 | </p> | |
225 | </td> | |
226 | <td> | |
227 | <p> | |
228 | <span class="blue">Max = 832ε (Mean = 38.1ε)</span> | |
229 | </p> | |
230 | </td> | |
231 | </tr> | |
232 | <tr> | |
233 | <td> | |
234 | <p> | |
235 | Non Central Beta, large parameters | |
236 | </p> | |
237 | </td> | |
238 | <td> | |
239 | <p> | |
240 | <span class="blue">Max = 3.41e+003ε (Mean = 475ε)</span> | |
241 | </p> | |
242 | </td> | |
243 | <td> | |
244 | <p> | |
245 | <span class="blue">Max = 1.18ε (Mean = 0.175ε)</span><br> | |
246 | <br> (<span class="emphasis"><em>Rmath 3.0.2:</em></span> <span class="red">Max | |
247 | = 1.01e+36ε (Mean = 1.19e+35ε) <a class="link" href="../../logs_and_tables/logs.html#errors_GNU_C_version_5_1_0_linux_double_non_central_beta_CDF_Rmath_3_0_2_Non_Central_Beta_large_parameters">And | |
248 | other failures.</a>)</span> | |
249 | </p> | |
250 | </td> | |
251 | <td> | |
252 | <p> | |
253 | <span class="blue">Max = 2.5e+04ε (Mean = 3.78e+03ε)</span> | |
254 | </p> | |
255 | </td> | |
256 | <td> | |
257 | <p> | |
258 | <span class="blue">Max = 2.57e+04ε (Mean = 4.43e+03ε)</span> | |
259 | </p> | |
260 | </td> | |
261 | </tr> | |
262 | </tbody> | |
263 | </table></div> | |
264 | </div> | |
265 | <br class="table-break"><div class="table"> | |
266 | <a name="math_toolkit.dist_ref.dists.nc_beta_dist.table_non_central_beta_CDF_complement"></a><p class="title"><b>Table 5.5. Error rates for non central beta CDF complement</b></p> | |
267 | <div class="table-contents"><table class="table" summary="Error rates for non central beta CDF complement"> | |
268 | <colgroup> | |
269 | <col> | |
270 | <col> | |
271 | <col> | |
272 | <col> | |
273 | <col> | |
274 | </colgroup> | |
275 | <thead><tr> | |
276 | <th> | |
277 | </th> | |
278 | <th> | |
279 | <p> | |
280 | Microsoft Visual C++ version 12.0<br> Win32<br> double | |
281 | </p> | |
282 | </th> | |
283 | <th> | |
284 | <p> | |
285 | GNU C++ version 5.1.0<br> linux<br> double | |
286 | </p> | |
287 | </th> | |
288 | <th> | |
289 | <p> | |
290 | GNU C++ version 5.1.0<br> linux<br> long double | |
291 | </p> | |
292 | </th> | |
293 | <th> | |
294 | <p> | |
295 | Sun compiler version 0x5130<br> Sun Solaris<br> long double | |
296 | </p> | |
297 | </th> | |
298 | </tr></thead> | |
299 | <tbody> | |
300 | <tr> | |
301 | <td> | |
302 | <p> | |
303 | Non Central Beta, medium parameters | |
304 | </p> | |
305 | </td> | |
306 | <td> | |
307 | <p> | |
308 | <span class="blue">Max = 619ε (Mean = 62.7ε)</span> | |
309 | </p> | |
310 | </td> | |
311 | <td> | |
312 | <p> | |
313 | <span class="blue">Max = 0.998ε (Mean = 0.0957ε)</span><br> | |
314 | <br> (<span class="emphasis"><em>Rmath 3.0.2:</em></span> <span class="red">Max | |
315 | = 7.5e+97ε (Mean = 1.37e+96ε) <a class="link" href="../../logs_and_tables/logs.html#errors_GNU_C_version_5_1_0_linux_double_non_central_beta_CDF_complement_Rmath_3_0_2_Non_Central_Beta_medium_parameters">And | |
316 | other failures.</a>)</span> | |
317 | </p> | |
318 | </td> | |
319 | <td> | |
320 | <p> | |
321 | <span class="blue">Max = 396ε (Mean = 50.7ε)</span> | |
322 | </p> | |
323 | </td> | |
324 | <td> | |
325 | <p> | |
326 | <span class="blue">Max = 554ε (Mean = 57.3ε)</span> | |
327 | </p> | |
328 | </td> | |
329 | </tr> | |
330 | <tr> | |
331 | <td> | |
332 | <p> | |
333 | Non Central Beta, large parameters | |
334 | </p> | |
335 | </td> | |
336 | <td> | |
337 | <p> | |
338 | <span class="blue">Max = 8.67e+003ε (Mean = 1.04e+003ε)</span> | |
339 | </p> | |
340 | </td> | |
341 | <td> | |
342 | <p> | |
343 | <span class="blue">Max = 0.986ε (Mean = 0.188ε)</span><br> | |
344 | <br> (<span class="emphasis"><em>Rmath 3.0.2:</em></span> <span class="red">Max | |
345 | = +INFε (Mean = +INFε) <a class="link" href="../../logs_and_tables/logs.html#errors_GNU_C_version_5_1_0_linux_double_non_central_beta_CDF_complement_Rmath_3_0_2_Non_Central_Beta_large_parameters">And | |
346 | other failures.</a>)</span> | |
347 | </p> | |
348 | </td> | |
349 | <td> | |
350 | <p> | |
351 | <span class="blue">Max = 6.83e+03ε (Mean = 993ε)</span> | |
352 | </p> | |
353 | </td> | |
354 | <td> | |
355 | <p> | |
356 | <span class="blue">Max = 3.56e+03ε (Mean = 704ε)</span> | |
357 | </p> | |
358 | </td> | |
359 | </tr> | |
360 | </tbody> | |
361 | </table></div> | |
362 | </div> | |
363 | <br class="table-break"><p> | |
364 | Error rates for the PDF, the complement of the CDF and for the quantile | |
365 | functions are broadly similar. | |
366 | </p> | |
367 | <h5> | |
368 | <a name="math_toolkit.dist_ref.dists.nc_beta_dist.h3"></a> | |
369 | <span class="phrase"><a name="math_toolkit.dist_ref.dists.nc_beta_dist.tests"></a></span><a class="link" href="nc_beta_dist.html#math_toolkit.dist_ref.dists.nc_beta_dist.tests">Tests</a> | |
370 | </h5> | |
371 | <p> | |
372 | There are two sets of test data used to verify this implementation: firstly | |
373 | we can compare with a few sample values generated by the <a href="http://www.r-project.org/" target="_top">R | |
374 | library</a>. Secondly, we have tables of test data, computed with this | |
375 | implementation and using interval arithmetic - this data should be accurate | |
376 | to at least 50 decimal digits - and is the used for our accuracy tests. | |
377 | </p> | |
378 | <h5> | |
379 | <a name="math_toolkit.dist_ref.dists.nc_beta_dist.h4"></a> | |
380 | <span class="phrase"><a name="math_toolkit.dist_ref.dists.nc_beta_dist.implementation"></a></span><a class="link" href="nc_beta_dist.html#math_toolkit.dist_ref.dists.nc_beta_dist.implementation">Implementation</a> | |
381 | </h5> | |
382 | <p> | |
383 | The CDF and its complement are evaluated as follows: | |
384 | </p> | |
385 | <p> | |
386 | First we determine which of the two values (the CDF or its complement) | |
387 | is likely to be the smaller, the crossover point is taken to be the mean | |
388 | of the distribution: for this we use the approximation due to: R. Chattamvelli | |
389 | and R. Shanmugam, "Algorithm AS 310: Computing the Non-Central Beta | |
390 | Distribution Function", Applied Statistics, Vol. 46, No. 1. (1997), | |
391 | pp. 146-156. | |
392 | </p> | |
393 | <p> | |
394 | <span class="inlinemediaobject"><img src="../../../../equations/nc_beta_ref3.svg"></span> | |
395 | </p> | |
396 | <p> | |
397 | Then either the CDF or its complement is computed using the relations: | |
398 | </p> | |
399 | <p> | |
400 | <span class="inlinemediaobject"><img src="../../../../equations/nc_beta_ref4.svg"></span> | |
401 | </p> | |
402 | <p> | |
403 | The summation is performed by starting at i = λ/2, and then recursing in | |
404 | both directions, using the usual recurrence relations for the Poisson PDF | |
405 | and incomplete beta functions. This is the "Method 2" described | |
406 | by: | |
407 | </p> | |
408 | <p> | |
409 | Denise Benton and K. Krishnamoorthy, "Computing discrete mixtures | |
410 | of continuous distributions: noncentral chisquare, noncentral t and the | |
411 | distribution of the square of the sample multiple correlation coefficient", | |
412 | Computational Statistics & Data Analysis 43 (2003) 249-267. | |
413 | </p> | |
414 | <p> | |
415 | Specific applications of the above formulae to the noncentral beta distribution | |
416 | can be found in: | |
417 | </p> | |
418 | <p> | |
419 | Russell V. Lenth, "Algorithm AS 226: Computing Noncentral Beta Probabilities", | |
420 | Applied Statistics, Vol. 36, No. 2. (1987), pp. 241-244. | |
421 | </p> | |
422 | <p> | |
423 | H. Frick, "Algorithm AS R84: A Remark on Algorithm AS 226: Computing | |
424 | Non-Central Beta Probabilities", Applied Statistics, Vol. 39, No. | |
425 | 2. (1990), pp. 311-312. | |
426 | </p> | |
427 | <p> | |
428 | Ming Long Lam, "Remark AS R95: A Remark on Algorithm AS 226: Computing | |
429 | Non-Central Beta Probabilities", Applied Statistics, Vol. 44, No. | |
430 | 4. (1995), pp. 551-552. | |
431 | </p> | |
432 | <p> | |
433 | Harry O. Posten, "An Effective Algorithm for the Noncentral Beta Distribution | |
434 | Function", The American Statistician, Vol. 47, No. 2. (May, 1993), | |
435 | pp. 129-131. | |
436 | </p> | |
437 | <p> | |
438 | R. Chattamvelli, "A Note on the Noncentral Beta Distribution Function", | |
439 | The American Statistician, Vol. 49, No. 2. (May, 1995), pp. 231-234. | |
440 | </p> | |
441 | <p> | |
442 | Of these, the Posten reference provides the most complete overview, and | |
443 | includes the modification starting iteration at λ/2. | |
444 | </p> | |
445 | <p> | |
446 | The main difference between this implementation and the above references | |
447 | is the direct computation of the complement when most efficient to do so, | |
448 | and the accumulation of the sum to -1 rather than subtracting the result | |
449 | from 1 at the end: this can substantially reduce the number of iterations | |
450 | required when the result is near 1. | |
451 | </p> | |
452 | <p> | |
453 | The PDF is computed using the methodology of Benton and Krishnamoorthy | |
454 | and the relation: | |
455 | </p> | |
456 | <p> | |
457 | <span class="inlinemediaobject"><img src="../../../../equations/nc_beta_ref1.svg"></span> | |
458 | </p> | |
459 | <p> | |
460 | Quantiles are computed using a specially modified version of <a class="link" href="../../roots/roots_noderiv/bracket_solve.html" title="Bracket and Solve Root">bracket | |
461 | and solve</a>, starting the search for the root at the mean of the distribution. | |
462 | (A Cornish-Fisher type expansion was also tried, but while this gets quite | |
463 | close to the root in many cases, when it is wrong it tends to introduce | |
464 | quite pathological behaviour: more investigation in this area is probably | |
465 | warranted). | |
466 | </p> | |
467 | </div> | |
468 | <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> | |
469 | <td align="left"></td> | |
470 | <td align="right"><div class="copyright-footer">Copyright © 2006-2010, 2012-2014 Nikhar Agrawal, | |
471 | Anton Bikineev, Paul A. Bristow, Marco Guazzone, Christopher Kormanyos, Hubert | |
472 | Holin, Bruno Lalande, John Maddock, Jeremy Murphy, Johan Råde, Gautam Sewani, | |
473 | Benjamin Sobotta, Thijs van den Berg, Daryle Walker and Xiaogang Zhang<p> | |
474 | Distributed under the Boost Software License, Version 1.0. (See accompanying | |
475 | 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>) | |
476 | </p> | |
477 | </div></td> | |
478 | </tr></table> | |
479 | <hr> | |
480 | <div class="spirit-nav"> | |
481 | <a accesskey="p" href="negative_binomial_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="nc_chi_squared_dist.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a> | |
482 | </div> | |
483 | </body> | |
484 | </html> |