# [Boost-bugs] [Boost C++ Libraries] #2877: Approximation error in the non central chi square distribution

Subject: [Boost-bugs] [Boost C++ Libraries] #2877: Approximation error in the non central chi square distribution
Date: 2009-03-20 17:08:29

#2877: Approximation error in the non central chi square distribution
-----------------------------------------+----------------------------------
Type: Bugs | Status: new
Milestone: Boost 1.39.0 | Component: math
Version: Boost 1.36.0 | Severity: Problem
Keywords: Approximation error |
-----------------------------------------+----------------------------------
Hi,

I'll like inform you about an error of approximation on the non central
chi square distribution.

When the freedom degree is equal to 3, the distribution calls the modified
bessel function of the first kind.

In this case, I0.5(x) = sqrt(2 / Ï€x) * sinh(x)
( see
http://www.boost.org/doc/libs/1_36_0/libs/math/doc/sf_and_dist/html/math_toolkit/special/bessel/mbessel.html
)

Nonetheless, it seems that you use yet the Berton and Krishnamoorthy
method and their recurrence, and that imply an error approximation.

For example, i compute the method with R.
let x = 5.0, freedom degree = 3.0 and the non-centrality parameter = 1.5
then
dchisq(5.0,3,1.5) = 0.0972573 (See the wikipedia example)

When i use I0.5(x) = sqrt(2 / Ï€x) * sinh(x) to compute the chi square
distribution, i find the same result.

conversely, when i use the boost library non_central_chi_squared.hpp, my
result is 0.0976656.

Note in the other cases, the deviation between the two results can be
greater

best regards,
```--