commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bill Murphy (JIRA)" <>
Subject [jira] [Created] (MATH-1257) NormalDistribution.cumulativeProbability() suffers from cancellation
Date Tue, 18 Aug 2015 22:31:47 GMT
Bill Murphy created MATH-1257:

             Summary: NormalDistribution.cumulativeProbability() suffers from cancellation
                 Key: MATH-1257
             Project: Commons Math
          Issue Type: Bug
    Affects Versions: 3.5
            Reporter: Bill Murphy
            Priority: Minor

I see the following around line 194:
        return 0.5 * (1 + Erf.erf(dev / (standardDeviation * SQRT2)));

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:
return 0.5 * Erf.erfc( -dev / SQRT2 );

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:
then look in the 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

View raw message