<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII"> <title>Noncentral Chi-Squared Distribution</title> <link rel="stylesheet" href="../../../../../../../../../doc/src/boostbook.css" type="text/css"> <meta name="generator" content="DocBook XSL Stylesheets V1.74.0"> <link rel="home" href="../../../../index.html" title="Math Toolkit"> <link rel="up" href="../dists.html" title="Distributions"> <link rel="prev" href="nc_beta_dist.html" title="Noncentral Beta Distribution"> <link rel="next" href="nc_f_dist.html" title="Noncentral F Distribution"> </head> <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> <table cellpadding="2" width="100%"><tr> <td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../../../boost.png"></td> <td align="center"><a href="../../../../../../../../../index.html">Home</a></td> <td align="center"><a href="../../../../../../../../../libs/libraries.htm">Libraries</a></td> <td align="center"><a href="http://www.boost.org/users/people.html">People</a></td> <td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td> <td align="center"><a href="../../../../../../../../../more/index.htm">More</a></td> </tr></table> <hr> <div class="spirit-nav"> <a accesskey="p" href="nc_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="nc_f_dist.html"><img src="../../../../../../../../../doc/src/images/next.png" alt="Next"></a> </div> <div class="section" lang="en"> <div class="titlepage"><div><div><h5 class="title"> <a name="math_toolkit.dist.dist_ref.dists.nc_chi_squared_dist"></a><a class="link" href="nc_chi_squared_dist.html" title="Noncentral Chi-Squared Distribution"> Noncentral Chi-Squared Distribution</a> </h5></div></div></div> <p> </p> <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_chi_squared</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span></pre> <p> </p> <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> <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> <span class="keyword">class</span> <a class="link" href="../../../policy.html" title="Policies">Policy</a> <span class="special">=</span> <a class="link" href="../../../policy/pol_ref/pol_ref_ref.html" title="Policy Class Reference">policies::policy<></a> <span class="special">></span> <span class="keyword">class</span> <span class="identifier">non_central_chi_squared_distribution</span><span class="special">;</span> <span class="keyword">typedef</span> <span class="identifier">non_central_chi_squared_distribution</span><span class="special"><></span> <span class="identifier">non_central_chi_squared</span><span class="special">;</span> <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="Policies">Policy</a><span class="special">></span> <span class="keyword">class</span> <span class="identifier">non_central_chi_squared_distribution</span> <span class="special">{</span> <span class="keyword">public</span><span class="special">:</span> <span class="keyword">typedef</span> <span class="identifier">RealType</span> <span class="identifier">value_type</span><span class="special">;</span> <span class="keyword">typedef</span> <span class="identifier">Policy</span> <span class="identifier">policy_type</span><span class="special">;</span> <span class="comment">// Constructor: </span> <span class="identifier">non_central_chi_squared_distribution</span><span class="special">(</span><span class="identifier">RealType</span> <span class="identifier">v</span><span class="special">,</span> <span class="identifier">RealType</span> <span class="identifier">lambda</span><span class="special">);</span> <span class="comment">// Accessor to degrees of freedom parameter v: </span> <span class="identifier">RealType</span> <span class="identifier">degrees_of_freedom</span><span class="special">()</span><span class="keyword">const</span><span class="special">;</span> <span class="comment">// Accessor to non centrality parameter lambda: </span> <span class="identifier">RealType</span> <span class="identifier">non_centrality</span><span class="special">()</span><span class="keyword">const</span><span class="special">;</span> <span class="comment">// Parameter finders: </span> <span class="keyword">static</span> <span class="identifier">RealType</span> <span class="identifier">find_degrees_of_freedom</span><span class="special">(</span><span class="identifier">RealType</span> <span class="identifier">lambda</span><span class="special">,</span> <span class="identifier">RealType</span> <span class="identifier">x</span><span class="special">,</span> <span class="identifier">RealType</span> <span class="identifier">p</span><span class="special">);</span> <span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">B</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">C</span><span class="special">></span> <span class="keyword">static</span> <span class="identifier">RealType</span> <span class="identifier">find_degrees_of_freedom</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">complemented3_type</span><span class="special"><</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">B</span><span class="special">,</span><span class="identifier">C</span><span class="special">>&</span> <span class="identifier">c</span><span class="special">);</span> <span class="keyword">static</span> <span class="identifier">RealType</span> <span class="identifier">find_non_centrality</span><span class="special">(</span><span class="identifier">RealType</span> <span class="identifier">v</span><span class="special">,</span> <span class="identifier">RealType</span> <span class="identifier">x</span><span class="special">,</span> <span class="identifier">RealType</span> <span class="identifier">p</span><span class="special">);</span> <span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">B</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">C</span><span class="special">></span> <span class="keyword">static</span> <span class="identifier">RealType</span> <span class="identifier">find_non_centrality</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">complemented3_type</span><span class="special"><</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">B</span><span class="special">,</span><span class="identifier">C</span><span class="special">>&</span> <span class="identifier">c</span><span class="special">);</span> <span class="special">};</span> <span class="special">}}</span> <span class="comment">// namespaces </span></pre> <p> The noncentral chi-squared distribution is a generalization of the <a class="link" href="chi_squared_dist.html" title="Chi Squared Distribution">Chi Squared Distribution</a>. If X<sub>i</sub> are ν independent, normally distributed random variables with means μ<sub>i</sub> and variances σ<sub>i</sub><sup>2</sup>, then the random variable </p> <p> <span class="inlinemediaobject"><img src="../../../../../equations/nc_chi_squ_ref1.png"></span> </p> <p> is distributed according to the noncentral chi-squared distribution. </p> <p> The noncentral chi-squared distribution has two parameters: ν which specifies the number of degrees of freedom (i.e. the number of X<sub>i</sub>), and λ which is related to the mean of the random variables X<sub>i</sub> by: </p> <p> <span class="inlinemediaobject"><img src="../../../../../equations/nc_chi_squ_ref2.png"></span> </p> <p> (Note that some references define λ as one half of the above sum). </p> <p> This leads to a PDF of: </p> <p> <span class="inlinemediaobject"><img src="../../../../../equations/nc_chi_squ_ref3.png"></span> </p> <p> where <span class="emphasis"><em>f(x;k)</em></span> is the central chi-squared distribution PDF, and <span class="emphasis"><em>I<sub>v</sub>(x)</em></span> is a modified Bessel function of the first kind. </p> <p> The following graph illustrates how the distribution changes for different values of λ: </p> <p> <span class="inlinemediaobject"><img src="../../../../../graphs/nccs_pdf.png" align="middle"></span> </p> <a name="math_toolkit.dist.dist_ref.dists.nc_chi_squared_dist.member_functions"></a><h5> <a name="id1048802"></a> <a class="link" href="nc_chi_squared_dist.html#math_toolkit.dist.dist_ref.dists.nc_chi_squared_dist.member_functions">Member Functions</a> </h5> <pre class="programlisting"><span class="identifier">non_central_chi_squared_distribution</span><span class="special">(</span><span class="identifier">RealType</span> <span class="identifier">v</span><span class="special">,</span> <span class="identifier">RealType</span> <span class="identifier">lambda</span><span class="special">);</span> </pre> <p> Constructs a Chi-Squared distribution with <span class="emphasis"><em>v</em></span> degrees of freedom and non-centrality parameter <span class="emphasis"><em>lambda</em></span>. </p> <p> Requires v > 0 and lambda >= 0, otherwise calls <a class="link" href="../../../main_overview/error_handling.html#domain_error">domain_error</a>. </p> <pre class="programlisting"><span class="identifier">RealType</span> <span class="identifier">degrees_of_freedom</span><span class="special">()</span><span class="keyword">const</span><span class="special">;</span> </pre> <p> Returns the parameter <span class="emphasis"><em>v</em></span> from which this object was constructed. </p> <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> </pre> <p> Returns the parameter <span class="emphasis"><em>lambda</em></span> from which this object was constructed. </p> <pre class="programlisting"><span class="keyword">static</span> <span class="identifier">RealType</span> <span class="identifier">find_degrees_of_freedom</span><span class="special">(</span><span class="identifier">RealType</span> <span class="identifier">lambda</span><span class="special">,</span> <span class="identifier">RealType</span> <span class="identifier">x</span><span class="special">,</span> <span class="identifier">RealType</span> <span class="identifier">p</span><span class="special">);</span> </pre> <p> This function returns the number of degrees of freedom <span class="emphasis"><em>v</em></span> such that: <code class="computeroutput"><span class="identifier">cdf</span><span class="special">(</span><span class="identifier">non_central_chi_squared</span><span class="special"><</span><span class="identifier">RealType</span><span class="special">,</span> <span class="identifier">Policy</span><span class="special">>(</span><span class="identifier">v</span><span class="special">,</span> <span class="identifier">lambda</span><span class="special">),</span> <span class="identifier">x</span><span class="special">)</span> <span class="special">==</span> <span class="identifier">p</span></code> </p> <pre class="programlisting"><span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">B</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">C</span><span class="special">></span> <span class="keyword">static</span> <span class="identifier">RealType</span> <span class="identifier">find_degrees_of_freedom</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">complemented3_type</span><span class="special"><</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">B</span><span class="special">,</span><span class="identifier">C</span><span class="special">>&</span> <span class="identifier">c</span><span class="special">);</span> </pre> <p> When called with argument <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">math</span><span class="special">::</span><span class="identifier">complement</span><span class="special">(</span><span class="identifier">lambda</span><span class="special">,</span> <span class="identifier">x</span><span class="special">,</span> <span class="identifier">q</span><span class="special">)</span></code> this function returns the number of degrees of freedom <span class="emphasis"><em>v</em></span> such that: </p> <p> <code class="computeroutput"><span class="identifier">cdf</span><span class="special">(</span><span class="identifier">complement</span><span class="special">(</span><span class="identifier">non_central_chi_squared</span><span class="special"><</span><span class="identifier">RealType</span><span class="special">,</span> <span class="identifier">Policy</span><span class="special">>(</span><span class="identifier">v</span><span class="special">,</span> <span class="identifier">lambda</span><span class="special">),</span> <span class="identifier">x</span><span class="special">))</span> <span class="special">==</span> <span class="identifier">q</span></code>. </p> <pre class="programlisting"><span class="keyword">static</span> <span class="identifier">RealType</span> <span class="identifier">find_non_centrality</span><span class="special">(</span><span class="identifier">RealType</span> <span class="identifier">v</span><span class="special">,</span> <span class="identifier">RealType</span> <span class="identifier">x</span><span class="special">,</span> <span class="identifier">RealType</span> <span class="identifier">p</span><span class="special">);</span> </pre> <p> This function returns the non centrality parameter <span class="emphasis"><em>lambda</em></span> such that: </p> <p> <code class="computeroutput"><span class="identifier">cdf</span><span class="special">(</span><span class="identifier">non_central_chi_squared</span><span class="special"><</span><span class="identifier">RealType</span><span class="special">,</span> <span class="identifier">Policy</span><span class="special">>(</span><span class="identifier">v</span><span class="special">,</span> <span class="identifier">lambda</span><span class="special">),</span> <span class="identifier">x</span><span class="special">)</span> <span class="special">==</span> <span class="identifier">p</span></code> </p> <pre class="programlisting"><span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">B</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">C</span><span class="special">></span> <span class="keyword">static</span> <span class="identifier">RealType</span> <span class="identifier">find_non_centrality</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">complemented3_type</span><span class="special"><</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">B</span><span class="special">,</span><span class="identifier">C</span><span class="special">>&</span> <span class="identifier">c</span><span class="special">);</span> </pre> <p> When called with argument <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">math</span><span class="special">::</span><span class="identifier">complement</span><span class="special">(</span><span class="identifier">v</span><span class="special">,</span> <span class="identifier">x</span><span class="special">,</span> <span class="identifier">q</span><span class="special">)</span></code> this function returns the non centrality parameter <span class="emphasis"><em>lambda</em></span> such that: </p> <p> <code class="computeroutput"><span class="identifier">cdf</span><span class="special">(</span><span class="identifier">complement</span><span class="special">(</span><span class="identifier">non_central_chi_squared</span><span class="special"><</span><span class="identifier">RealType</span><span class="special">,</span> <span class="identifier">Policy</span><span class="special">>(</span><span class="identifier">v</span><span class="special">,</span> <span class="identifier">lambda</span><span class="special">),</span> <span class="identifier">x</span><span class="special">))</span> <span class="special">==</span> <span class="identifier">q</span></code>. </p> <a name="math_toolkit.dist.dist_ref.dists.nc_chi_squared_dist.non_member_accessors"></a><h5> <a name="id1051185"></a> <a class="link" href="nc_chi_squared_dist.html#math_toolkit.dist.dist_ref.dists.nc_chi_squared_dist.non_member_accessors">Non-member Accessors</a> </h5> <p> All the <a class="link" href="../nmp.html" title="Non-Member Properties">usual non-member accessor functions</a> that are generic to all distributions are supported: <a class="link" href="../nmp.html#math.dist.cdf">Cumulative Distribution Function</a>, <a class="link" href="../nmp.html#math.dist.pdf">Probability Density Function</a>, <a class="link" href="../nmp.html#math.dist.quantile">Quantile</a>, <a class="link" href="../nmp.html#math.dist.hazard">Hazard Function</a>, <a class="link" href="../nmp.html#math.dist.chf">Cumulative Hazard Function</a>, <a class="link" href="../nmp.html#math.dist.mean">mean</a>, <a class="link" href="../nmp.html#math.dist.median">median</a>, <a class="link" href="../nmp.html#math.dist.mode">mode</a>, <a class="link" href="../nmp.html#math.dist.variance">variance</a>, <a class="link" href="../nmp.html#math.dist.sd">standard deviation</a>, <a class="link" href="../nmp.html#math.dist.skewness">skewness</a>, <a class="link" href="../nmp.html#math.dist.kurtosis">kurtosis</a>, <a class="link" href="../nmp.html#math.dist.kurtosis_excess">kurtosis_excess</a>, <a class="link" href="../nmp.html#math.dist.range">range</a> and <a class="link" href="../nmp.html#math.dist.support">support</a>. </p> <p> The domain of the random variable is [0, +∞]. </p> <a name="math_toolkit.dist.dist_ref.dists.nc_chi_squared_dist.examples"></a><h5> <a name="id1051285"></a> <a class="link" href="nc_chi_squared_dist.html#math_toolkit.dist.dist_ref.dists.nc_chi_squared_dist.examples">Examples</a> </h5> <p> There is a <a class="link" href="../../stat_tut/weg/nccs_eg.html" title="Non Central Chi Squared Example">worked example</a> for the noncentral chi-squared distribution. </p> <a name="math_toolkit.dist.dist_ref.dists.nc_chi_squared_dist.accuracy"></a><h5> <a name="id1051313"></a> <a class="link" href="nc_chi_squared_dist.html#math_toolkit.dist.dist_ref.dists.nc_chi_squared_dist.accuracy">Accuracy</a> </h5> <p> The following table shows the peak errors (in units of <a href="http://en.wikipedia.org/wiki/Machine_epsilon" target="_top">epsilon</a>) found on various platforms with various floating-point types, along with comparisons to the <a href="http://www.r-project.org/" target="_top">R-2.5.1 Math library</a>. Unless otherwise specified, any floating-point type that is narrower than the one shown will have <a class="link" href="../../../backgrounders/relative_error.html#zero_error">effectively zero error</a>. </p> <div class="table"> <a name="id1051343"></a><p class="title"><b>Table 14. Errors In CDF of the Noncentral Chi-Squared</b></p> <div class="table-contents"><table class="table" summary="Errors In CDF of the Noncentral Chi-Squared"> <colgroup> <col> <col> <col> <col> </colgroup> <thead><tr> <th> <p> Significand Size </p> </th> <th> <p> Platform and Compiler </p> </th> <th> <p> ν,λ < 200 </p> </th> <th> <p> ν,λ > 200 </p> </th> </tr></thead> <tbody> <tr> <td> <p> 53 </p> </td> <td> <p> Win32, Visual C++ 8 </p> </td> <td> <p> Peak=50 Mean=9.9 </p> <p> R Peak=685 Mean=109 </p> </td> <td> <p> Peak=9780 Mean=718 </p> <p> R Peak=3x10<sup>8</sup> Mean=2x10<sup>7</sup> </p> </td> </tr> <tr> <td> <p> 64 </p> </td> <td> <p> RedHat Linux IA32, gcc-4.1.1 </p> </td> <td> <p> Peak=270 Mean=27 </p> </td> <td> <p> Peak=7900 Mean=900 </p> </td> </tr> <tr> <td> <p> 64 </p> </td> <td> <p> Redhat Linux IA64, gcc-3.4.4 </p> </td> <td> <p> Peak=107 Mean=17 </p> </td> <td> <p> Peak=5000 Mean=630 </p> </td> </tr> <tr> <td> <p> 113 </p> </td> <td> <p> HPUX IA64, aCC A.06.06 </p> </td> <td> <p> Peak=270 Mean=20 </p> </td> <td> <p> Peak=4600 Mean=560 </p> </td> </tr> </tbody> </table></div> </div> <br class="table-break"><p> Error rates for the complement of the CDF and for the quantile functions are broadly similar. Special mention should go to the <code class="computeroutput"><span class="identifier">mode</span></code> function: there is no closed form for this function, so it is evaluated numerically by finding the maxima of the PDF: in principal this can not produce an accuracy greater than the square root of the machine epsilon. </p> <a name="math_toolkit.dist.dist_ref.dists.nc_chi_squared_dist.tests"></a><h5> <a name="id1051572"></a> <a class="link" href="nc_chi_squared_dist.html#math_toolkit.dist.dist_ref.dists.nc_chi_squared_dist.tests">Tests</a> </h5> <p> There are two sets of test data used to verify this implementation: firstly we can compare with published data, for example with Table 6 of "Self-Validating Computations of Probabilities for Selected Central and Noncentral Univariate Probability Functions", Morgan C. Wang and William J. Kennedy, Journal of the American Statistical Association, Vol. 89, No. 427. (Sep., 1994), pp. 878-887. Secondly, we have tables of test data, computed with this implementation and using interval arithmetic - this data should be accurate to at least 50 decimal digits - and is the used for our accuracy tests. </p> <a name="math_toolkit.dist.dist_ref.dists.nc_chi_squared_dist.implementation"></a><h5> <a name="id1051591"></a> <a class="link" href="nc_chi_squared_dist.html#math_toolkit.dist.dist_ref.dists.nc_chi_squared_dist.implementation">Implementation</a> </h5> <p> The CDF and its complement are evaluated as follows: </p> <p> First we determine which of the two values (the CDF or its complement) is likely to be the smaller: for this we can use the relation due to Temme (see "Asymptotic and Numerical Aspects of the Noncentral Chi-Square Distribution", N. M. Temme, Computers Math. Applic. Vol 25, No. 5, 55-63, 1993) that: </p> <p> F(ν,λ;ν+λ) ≈ 0.5 </p> <p> and so compute the CDF when the random variable is less than ν+λ, and its complement when the random variable is greater than ν+λ. If necessary the computed result is then subtracted from 1 to give the desired result (the CDF or its complement). </p> <p> For small values of the non centrality parameter, the CDF is computed using the method of Ding (see "Algorithm AS 275: Computing the Non-Central #2 Distribution Function", Cherng G. Ding, Applied Statistics, Vol. 41, No. 2. (1992), pp. 478-482). This uses the following series representation: </p> <p> <span class="inlinemediaobject"><img src="../../../../../equations/nc_chi_squ_ref4.png"></span> </p> <p> which requires just one call to <a class="link" href="../../../special/sf_gamma/gamma_derivatives.html" title="Derivative of the Incomplete Gamma Function">gamma_p_derivative</a> with the subsequent terms being computed by recursion as shown above. </p> <p> For larger values of the non-centrality parameter, Ding's method can take an unreasonable number of terms before convergence is achieved. Furthermore, the largest term is not the first term, so in extreme cases the first term may be zero, leading to a zero result, even though the true value may be non-zero. </p> <p> Therefore, when the non-centrality parameter is greater than 200, the method due to Krishnamoorthy (see "Computing discrete mixtures of continuous distributions: noncentral chisquare, noncentral t and the distribution of the square of the sample multiple correlation coefficient", Denise Benton and K. Krishnamoorthy, Computational Statistics & Data Analysis, 43, (2003), 249-267) is used. </p> <p> This method uses the well known sum: </p> <p> <span class="inlinemediaobject"><img src="../../../../../equations/nc_chi_squ_ref5.png"></span> </p> <p> Where P<sub>a</sub>(x) is the incomplete gamma function. </p> <p> The method starts at the λth term, which is where the Poisson weighting function achieves its maximum value, although this is not necessarily the largest overall term. Subsequent terms are calculated via the normal recurrence relations for the incomplete gamma function, and iteration proceeds both forwards and backwards until sufficient precision has been achieved. It should be noted that recurrence in the forwards direction of P<sub>a</sub>(x) is numerically unstable. However, since we always start <span class="emphasis"><em>after</em></span> the largest term in the series, numeric instability is introduced more slowly than the series converges. </p> <p> Computation of the complement of the CDF uses an extension of Krishnamoorthy's method, given that: </p> <p> <span class="inlinemediaobject"><img src="../../../../../equations/nc_chi_squ_ref6.png"></span> </p> <p> we can again start at the λ'th term and proceed in both directions from there until the required precision is achieved. This time it is backwards recursion on the incomplete gamma function Q<sub>a</sub>(x) which is unstable. However, as long as we start well <span class="emphasis"><em>before</em></span> the largest term, this is not an issue in practice. </p> <p> The PDF is computed directly using the relation: </p> <p> <span class="inlinemediaobject"><img src="../../../../../equations/nc_chi_squ_ref3.png"></span> </p> <p> Where <span class="emphasis"><em>f(x; v)</em></span> is the PDF of the central <a class="link" href="chi_squared_dist.html" title="Chi Squared Distribution">Chi Squared Distribution</a> and <span class="emphasis"><em>I<sub>v</sub>(x)</em></span> is a modified Bessel function, see <a class="link" href="../../../special/bessel/mbessel.html" title="Modified Bessel Functions of the First and Second Kinds">cyl_bessel_i</a>. For small values of the non-centrality parameter the relation in terms of <a class="link" href="../../../special/bessel/mbessel.html" title="Modified Bessel Functions of the First and Second Kinds">cyl_bessel_i</a> is used. However, this method fails for large values of the non-centrality parameter, so in that case the infinite sum is evaluated using the method of Benton and Krishnamoorthy, and the usual recurrence relations for successive terms. </p> <p> The quantile functions are computed by numeric inversion of the CDF. </p> <p> There is no <a href="http://en.wikipedia.org/wiki/Closed_form" target="_top">closed form</a> for the mode of the noncentral chi-squared distribution: it is computed numerically by finding the maximum of the PDF. Likewise, the median is computed numerically via the quantile. </p> <p> The remaining non-member functions use the following formulas: </p> <p> <span class="inlinemediaobject"><img src="../../../../../equations/nc_chi_squ_ref7.png"></span> </p> <p> Some analytic properties of noncentral distributions (particularly unimodality, and monotonicity of their modes) are surveyed and summarized by: </p> <p> Andrea van Aubel & Wolfgang Gawronski, Applied Mathematics and Computation, 141 (2003) 3-12. </p> </div> <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> <td align="left"></td> <td align="right"><div class="copyright-footer">Copyright © 2006 , 2007, 2008, 2009 John Maddock, Paul A. Bristow, Hubert Holin, Xiaogang Zhang, Bruno Lalande, Johan Råde, Gautam Sewani and Thijs van den Berg<p> Distributed under the Boost Software License, Version 1.0. (See accompanying 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>) </p> </div></td> </tr></table> <hr> <div class="spirit-nav"> <a accesskey="p" href="nc_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="nc_f_dist.html"><img src="../../../../../../../../../doc/src/images/next.png" alt="Next"></a> </div> </body> </html>