Opened 8 years ago

Closed 8 years ago

#2877 closed Bugs (fixed)

Approximation error in the non central chi square distribution

Reported by: cedric.naud@… Owned by: John Maddock
Milestone: Boost 1.39.0 Component: math
Version: Boost 1.36.0 Severity: Problem
Keywords: Approximation error Cc:



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 )

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, Cédric Naud

Attachments (1)

bessel.patch (616 bytes) - added by John Maddock 8 years ago.

Download all attachments as: .zip

Change History (4)

comment:1 Changed 8 years ago by John Maddock

Status: newassigned

Confirmed as a bug, I just can't spot the error at present...

Changed 8 years ago by John Maddock

Attachment: bessel.patch added

comment:2 Changed 8 years ago by John Maddock

It's a bug in cyl_bessel_i that's causing the issue - a patch is attached to this ticket, will be in SVN shortly.

comment:3 Changed 8 years ago by John Maddock

Resolution: fixed
Status: assignedclosed

(In [51890]) Fix bug in cyl_bessel_i that hits when v=0.5 and x is small. Fix return type of signbit to match C99 std. Update and regenerate docs. Fixes #2877.

Modify Ticket

Change Properties
Set your email in Preferences
as closed The owner will remain John Maddock.
The resolution will be deleted.

Add Comment

E-mail address and name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.