1<html> 2<head> 3<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 4<title>Noncentral F 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.12.0"> 8<link rel="up" href="../dists.html" title="Distributions"> 9<link rel="prev" href="nc_chi_squared_dist.html" title="Noncentral Chi-Squared Distribution"> 10<link rel="next" href="nc_t_dist.html" title="Noncentral T 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="nc_chi_squared_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_t_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_f_dist"></a><a class="link" href="nc_f_dist.html" title="Noncentral F Distribution">Noncentral F 28 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_f</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 21. 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_f_distribution</span><span class="special">;</span> 36 37<span class="keyword">typedef</span> <span class="identifier">non_central_f_distribution</span><span class="special"><></span> <span class="identifier">non_central_f</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 21. Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">></span> 40<span class="keyword">class</span> <span class="identifier">non_central_f_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_f_distribution</span><span class="special">(</span><span class="identifier">RealType</span> <span class="identifier">v1</span><span class="special">,</span> <span class="identifier">RealType</span> <span class="identifier">v2</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 degrees_of_freedom parameters v1 & v2:</span> 50 <span class="identifier">RealType</span> <span class="identifier">degrees_of_freedom1</span><span class="special">()</span><span class="keyword">const</span><span class="special">;</span> 51 <span class="identifier">RealType</span> <span class="identifier">degrees_of_freedom2</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 F distribution is a generalization of the <a class="link" href="f_dist.html" title="F Distribution">Fisher 61 F Distribution</a>. It is defined as the ratio 62 </p> 63<div class="blockquote"><blockquote class="blockquote"><p> 64 <span class="serif_italic">F = (X/v1) / (Y/v2)</span> 65 </p></blockquote></div> 66<p> 67 where X is a noncentral χ<sup>2</sup> 68random variable with <span class="emphasis"><em>v1</em></span> degrees 69 of freedom and non-centrality parameter λ, and Y is a central χ<sup>2</sup> random variable 70 with <span class="emphasis"><em>v2</em></span> degrees of freedom. 71 </p> 72<p> 73 This gives the following PDF: 74 </p> 75<div class="blockquote"><blockquote class="blockquote"><p> 76 <span class="inlinemediaobject"><img src="../../../../equations/nc_f_ref1.svg"></span> 77 78 </p></blockquote></div> 79<p> 80 where <span class="emphasis"><em>L<sub>a</sub><sup>b</sup>(c)</em></span> is a generalised Laguerre polynomial 81 and <span class="emphasis"><em>B(a,b)</em></span> is the <a class="link" href="../../sf_beta/beta_function.html" title="Beta">beta</a> 82 function, or 83 </p> 84<div class="blockquote"><blockquote class="blockquote"><p> 85 <span class="inlinemediaobject"><img src="../../../../equations/nc_f_ref2.svg"></span> 86 87 </p></blockquote></div> 88<p> 89 The following graph illustrates how the distribution changes for different 90 values of λ: 91 </p> 92<div class="blockquote"><blockquote class="blockquote"><p> 93 <span class="inlinemediaobject"><img src="../../../../graphs/nc_f_pdf.svg" align="middle"></span> 94 95 </p></blockquote></div> 96<h5> 97<a name="math_toolkit.dist_ref.dists.nc_f_dist.h0"></a> 98 <span class="phrase"><a name="math_toolkit.dist_ref.dists.nc_f_dist.member_functions"></a></span><a class="link" href="nc_f_dist.html#math_toolkit.dist_ref.dists.nc_f_dist.member_functions">Member 99 Functions</a> 100 </h5> 101<pre class="programlisting"><span class="identifier">non_central_f_distribution</span><span class="special">(</span><span class="identifier">RealType</span> <span class="identifier">v1</span><span class="special">,</span> <span class="identifier">RealType</span> <span class="identifier">v2</span><span class="special">,</span> <span class="identifier">RealType</span> <span class="identifier">lambda</span><span class="special">);</span> 102</pre> 103<p> 104 Constructs a non-central beta distribution with parameters <span class="emphasis"><em>v1</em></span> 105 and <span class="emphasis"><em>v2</em></span> and non-centrality parameter <span class="emphasis"><em>lambda</em></span>. 106 </p> 107<p> 108 Requires <span class="emphasis"><em>v1</em></span> > 0, <span class="emphasis"><em>v2</em></span> > 0 109 and lambda >= 0, otherwise calls <a class="link" href="../../error_handling.html#math_toolkit.error_handling.domain_error">domain_error</a>. 110 </p> 111<pre class="programlisting"><span class="identifier">RealType</span> <span class="identifier">degrees_of_freedom1</span><span class="special">()</span><span class="keyword">const</span><span class="special">;</span> 112</pre> 113<p> 114 Returns the parameter <span class="emphasis"><em>v1</em></span> from which this object was 115 constructed. 116 </p> 117<pre class="programlisting"><span class="identifier">RealType</span> <span class="identifier">degrees_of_freedom2</span><span class="special">()</span><span class="keyword">const</span><span class="special">;</span> 118</pre> 119<p> 120 Returns the parameter <span class="emphasis"><em>v2</em></span> from which this object was 121 constructed. 122 </p> 123<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> 124</pre> 125<p> 126 Returns the non-centrality parameter <span class="emphasis"><em>lambda</em></span> from which 127 this object was constructed. 128 </p> 129<h5> 130<a name="math_toolkit.dist_ref.dists.nc_f_dist.h1"></a> 131 <span class="phrase"><a name="math_toolkit.dist_ref.dists.nc_f_dist.non_member_accessors"></a></span><a class="link" href="nc_f_dist.html#math_toolkit.dist_ref.dists.nc_f_dist.non_member_accessors">Non-member 132 Accessors</a> 133 </h5> 134<p> 135 All the <a class="link" href="../nmp.html" title="Non-Member Properties">usual non-member accessor 136 functions</a> that are generic to all distributions are supported: 137 <a class="link" href="../nmp.html#math_toolkit.dist_ref.nmp.cdf">Cumulative Distribution Function</a>, 138 <a class="link" href="../nmp.html#math_toolkit.dist_ref.nmp.pdf">Probability Density Function</a>, 139 <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>, 140 <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>, 141 <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>, 142 <a class="link" href="../nmp.html#math_toolkit.dist_ref.nmp.sd">standard deviation</a>, 143 <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>, 144 <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>. 145 </p> 146<p> 147 The domain of the random variable is [0, +∞]. 148 </p> 149<h5> 150<a name="math_toolkit.dist_ref.dists.nc_f_dist.h2"></a> 151 <span class="phrase"><a name="math_toolkit.dist_ref.dists.nc_f_dist.accuracy"></a></span><a class="link" href="nc_f_dist.html#math_toolkit.dist_ref.dists.nc_f_dist.accuracy">Accuracy</a> 152 </h5> 153<p> 154 This distribution is implemented in terms of the <a class="link" href="nc_beta_dist.html" title="Noncentral Beta Distribution">Noncentral 155 Beta Distribution</a>: refer to that distribution for accuracy data. 156 </p> 157<h5> 158<a name="math_toolkit.dist_ref.dists.nc_f_dist.h3"></a> 159 <span class="phrase"><a name="math_toolkit.dist_ref.dists.nc_f_dist.tests"></a></span><a class="link" href="nc_f_dist.html#math_toolkit.dist_ref.dists.nc_f_dist.tests">Tests</a> 160 </h5> 161<p> 162 Since this distribution is implemented by adapting another distribution, 163 the tests consist of basic sanity checks computed by the <a href="http://www.r-project.org/" target="_top">R-2.5.1 164 Math library statistical package</a> and its pbeta and dbeta functions. 165 </p> 166<h5> 167<a name="math_toolkit.dist_ref.dists.nc_f_dist.h4"></a> 168 <span class="phrase"><a name="math_toolkit.dist_ref.dists.nc_f_dist.implementation"></a></span><a class="link" href="nc_f_dist.html#math_toolkit.dist_ref.dists.nc_f_dist.implementation">Implementation</a> 169 </h5> 170<p> 171 In the following table <span class="emphasis"><em>v1</em></span> and <span class="emphasis"><em>v2</em></span> 172 are the first and second degrees of freedom parameters of the distribution, 173 λ 174is the non-centrality parameter, <span class="emphasis"><em>x</em></span> is the random variate, 175 <span class="emphasis"><em>p</em></span> is the probability, and <span class="emphasis"><em>q = 1-p</em></span>. 176 </p> 177<div class="informaltable"><table class="table"> 178<colgroup> 179<col> 180<col> 181</colgroup> 182<thead><tr> 183<th> 184 <p> 185 Function 186 </p> 187 </th> 188<th> 189 <p> 190 Implementation Notes 191 </p> 192 </th> 193</tr></thead> 194<tbody> 195<tr> 196<td> 197 <p> 198 pdf 199 </p> 200 </td> 201<td> 202 <p> 203 Implemented in terms of the non-central beta PDF using the relation: 204 </p> 205 <p> 206 <span class="serif_italic">f(x;v1,v2;λ) = (v1/v2) / ((1+y)*(1+y)) 207 * g(y/(1+y);v1/2,v2/2;λ)</span> 208 </p> 209 <p> 210 where <span class="serif_italic">g(x; a, b; λ)</span> is the 211 non central beta PDF, and: 212 </p> 213 <p> 214 <span class="serif_italic">y = x * v1 / v2</span> 215 </p> 216 </td> 217</tr> 218<tr> 219<td> 220 <p> 221 cdf 222 </p> 223 </td> 224<td> 225 <p> 226 Using the relation: 227 </p> 228 <p> 229 <span class="serif_italic">p = B<sub>y</sub>(v1/2, v2/2; λ)</span> 230 </p> 231 <p> 232 where <span class="serif_italic">B<sub>x</sub>(a, b; λ)</span> is the 233 noncentral beta distribution CDF and 234 </p> 235 <p> 236 <span class="serif_italic">y = x * v1 / v2</span> 237 </p> 238 </td> 239</tr> 240<tr> 241<td> 242 <p> 243 cdf complement 244 </p> 245 </td> 246<td> 247 <p> 248 Using the relation: 249 </p> 250 <p> 251 <span class="serif_italic">q = 1 - B<sub>y</sub>(v1/2, v2/2; λ)</span> 252 </p> 253 <p> 254 where <span class="serif_italic">1 - B<sub>x</sub>(a, b; λ)</span> is 255 the complement of the noncentral beta distribution CDF and 256 </p> 257 <p> 258 <span class="serif_italic">y = x * v1 / v2</span> 259 </p> 260 </td> 261</tr> 262<tr> 263<td> 264 <p> 265 quantile 266 </p> 267 </td> 268<td> 269 <p> 270 Using the relation: 271 </p> 272 <p> 273 <span class="serif_italic">x = (bx / (1-bx)) * (v1 / v2)</span> 274 </p> 275 <p> 276 where 277 </p> 278 <p> 279 <span class="serif_italic">bx = Q<sub>p</sub><sup>-1</sup>(v1/2, v2/2; λ)</span> 280 </p> 281 <p> 282 and 283 </p> 284 <p> 285 <span class="serif_italic">Q<sub>p</sub><sup>-1</sup>(v1/2, v2/2; λ)</span> 286 </p> 287 <p> 288 is the noncentral beta quantile. 289 </p> 290 </td> 291</tr> 292<tr> 293<td> 294 <p> 295 quantile 296 </p> 297 <p> 298 from the complement 299 </p> 300 </td> 301<td> 302 <p> 303 Using the relation: 304 </p> 305 <p> 306 <span class="serif_italic">x = (bx / (1-bx)) * (v1 / v2)</span> 307 </p> 308 <p> 309 where 310 </p> 311 <p> 312 <span class="serif_italic">bx = QC<sub>q</sub><sup>-1</sup>(v1/2, v2/2; λ)</span> 313 </p> 314 <p> 315 and 316 </p> 317 <p> 318 <span class="serif_italic">QC<sub>q</sub><sup>-1</sup>(v1/2, v2/2; λ)</span> 319 </p> 320 <p> 321 is the noncentral beta quantile from the complement. 322 </p> 323 </td> 324</tr> 325<tr> 326<td> 327 <p> 328 mean 329 </p> 330 </td> 331<td> 332 <p> 333 <span class="serif_italic">v2 * (v1 + l) / (v1 * (v2 - 2))</span> 334 </p> 335 </td> 336</tr> 337<tr> 338<td> 339 <p> 340 mode 341 </p> 342 </td> 343<td> 344 <p> 345 By numeric maximalisation of the PDF. 346 </p> 347 </td> 348</tr> 349<tr> 350<td> 351 <p> 352 variance 353 </p> 354 </td> 355<td> 356 <p> 357 Refer to, <a href="http://mathworld.wolfram.com/NoncentralF-Distribution.html" target="_top">Weisstein, 358 Eric W. "Noncentral F-Distribution." From MathWorld--A 359 Wolfram Web Resource.</a> 360 </p> 361 </td> 362</tr> 363<tr> 364<td> 365 <p> 366 skewness 367 </p> 368 </td> 369<td> 370 <p> 371 Refer to, <a href="http://mathworld.wolfram.com/NoncentralF-Distribution.html" target="_top">Weisstein, 372 Eric W. "Noncentral F-Distribution." From MathWorld--A 373 Wolfram Web Resource.</a>, and to the <a href="http://reference.wolfram.com/mathematica/ref/NoncentralFRatioDistribution.html" target="_top">Mathematica 374 documentation</a> 375 </p> 376 </td> 377</tr> 378<tr> 379<td> 380 <p> 381 kurtosis and kurtosis excess 382 </p> 383 </td> 384<td> 385 <p> 386 Refer to, <a href="http://mathworld.wolfram.com/NoncentralF-Distribution.html" target="_top">Weisstein, 387 Eric W. "Noncentral F-Distribution." From MathWorld--A 388 Wolfram Web Resource.</a>, and to the <a href="http://reference.wolfram.com/mathematica/ref/NoncentralFRatioDistribution.html" target="_top">Mathematica 389 documentation</a> 390 </p> 391 </td> 392</tr> 393</tbody> 394</table></div> 395<p> 396 Some analytic properties of noncentral distributions (particularly unimodality, 397 and monotonicity of their modes) are surveyed and summarized by: 398 </p> 399<p> 400 Andrea van Aubel & Wolfgang Gawronski, Applied Mathematics and Computation, 401 141 (2003) 3-12. 402 </p> 403</div> 404<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> 405<td align="left"></td> 406<td align="right"><div class="copyright-footer">Copyright © 2006-2019 Nikhar 407 Agrawal, Anton Bikineev, Paul A. Bristow, Marco Guazzone, Christopher Kormanyos, 408 Hubert Holin, Bruno Lalande, John Maddock, Jeremy Murphy, Matthew Pulver, Johan 409 Råde, Gautam Sewani, Benjamin Sobotta, Nicholas Thompson, Thijs van den Berg, 410 Daryle Walker and Xiaogang Zhang<p> 411 Distributed under the Boost Software License, Version 1.0. (See accompanying 412 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>) 413 </p> 414</div></td> 415</tr></table> 416<hr> 417<div class="spirit-nav"> 418<a accesskey="p" href="nc_chi_squared_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_t_dist.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a> 419</div> 420</body> 421</html> 422