I think (2) may be simplest and best ....I dont really think that
throwing an exception here is appropriate at all. It mat be possible
however, to determine the resolution as you suggest in (1). I'm not sure
what packages like R do internally currently.
> pnorm(-100)
[1] 0
> pnorm(100)
[1] 1
Rory
Phil Steitz (JIRA) wrote:
[ https://issues.apache.org/jira/browse/MATH-167?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12510905 ]
Phil Steitz commented on MATH-167:
----------------------------------
Thanks for reporting this. I see three alternatives to address - appreciate
comments.
1) Determine tail resolution possible with current impl (hopefully not different on
different JDKs, platforms) and "top code", checking arguments and returning 0
or 1, resp if argument is too far in SD units from the mean. To find the cut points,
empirically determine where convergence starts to fail. Document the cut points in
javadoc for Impl.
2) Catch ConvergenceException and return 0 or 1, resp if argument is far from
the mean; rethrow otherwise (though this should never happen).
3) Resolve as WONTFIX and leave it to client to catch and handle
ConvergenceException, examining argument. Document algorithm more fully and
warn that ConvergenceException will be thrown if tail probability cannot be
accurately estimated or distinguished from 0.
My first thought was 2 and I guess I still favor that, since 3) is inconvenient
for users and 1) may not be stable unless cut points are conservative.
Note that this same problem may apply to tail probablilities of other
continuous distributions and we should check and address all of these before
resolving this issue.
ConvergenceException in normal CDF
----------------------------------
Key: MATH-167
URL: https://issues.apache.org/jira/browse/MATH-167
Project: Commons Math
Issue Type: Bug
Reporter: Mikko Kauppila
Priority: Minor
NormalDistributionImpl::cumulativeProbability(double x) throws
ConvergenceException
if x deviates too much from the mean. For example, when x=+/-100, mean=0, sd=1.
Of course the value of the CDF is hard to evaluate in these cases,
but effectively it should be either zero or one.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]