You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Gilles (JIRA)" <ji...@apache.org> on 2015/08/19 23:16:46 UTC
[jira] [Resolved] (MATH-1257)
NormalDistribution.cumulativeProbability() suffers from cancellation
[ https://issues.apache.org/jira/browse/MATH-1257?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Gilles resolved MATH-1257.
--------------------------
Resolution: Fixed
Fix Version/s: 3.6
4.0
Change applied in the following commits:
03178c8b15f1b522b98ded0f83cfb0e79f5ec4d3 (4.0)
49a9e6e8742cb6e05abf0219705338d95f732e12 (3.6)
> NormalDistribution.cumulativeProbability() suffers from cancellation
> --------------------------------------------------------------------
>
> Key: MATH-1257
> URL: https://issues.apache.org/jira/browse/MATH-1257
> Project: Commons Math
> Issue Type: Bug
> Affects Versions: 3.5
> Reporter: Bill Murphy
> Priority: Minor
> Fix For: 4.0, 3.6
>
> Attachments: MATH-1257.patch
>
>
> I see the following around line 194:
> {noformat}
> return 0.5 * (1 + Erf.erf(dev / (standardDeviation * SQRT2)));
> {noformat}
> When erf() returns a very small value, this cancels in the addition with the "1.0" which leads to poor precision in the results.
> I would suggest changing this line to read more like:
> {noformat}
> return 0.5 * Erf.erfc( -dev / standardDeviation * SQRT2 );
> {noformat}
> Should you want some test cases for "extreme values" (one might argue that within 10 standard deviations isn't all that extreme) then you can check the following: http://www.jstatsoft.org/v52/i07/ then look in the v52i07-xls.zip at replication-01-distribution-standard-normal.xls
> I think you will also find that evaluation of expressions such as {noformat}NormalDistribution( 0, 1 ).cumulativeProbability( -10.0 );{noformat}
> are pretty far off.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)