Bug 15075 - Inf value returned by beta function
Inf value returned by beta function
Status: CLOSED FIXED
Product: R
Classification: Unclassified
Component: Accuracy
R 2.15.1 patched
All All
: P5 major
Assigned To: R-core
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-10-17 10:55 UTC by Alberto
Modified: 2012-10-19 19:02 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alberto 2012-10-17 10:55:32 UTC
If you try the commands

curve(beta(x, 0.01), from=169, to=172, n=1000)

and

curve(beta(0.01, x), from=169, to=172, n=1000)

you can see a discontinuity due to some Inf values returned by the beta function, maybe related to the Inf value of function gamma

> gamma(171.62)
[1] Inf
Warning message:
value out of range in 'gammafn'

even though the Inf value returned by the gamma function is due to a to large result, the Inf value of the beta function is not justify.
Comment 1 Brian Ripley 2012-10-19 19:02:52 UTC
The calculation was gammafn(a) * gammafn(b) / gammafn(a+b), and the first product overflowed, even though all the values are finite.

The order of calculation has been changed for R > 2.15.2.