STATISTICS-32: New "survivalProbability" function for all discrete
distributions.

While a naive implementation would simply be
`1-cumulativeProbability`, that would result
in loss of precision.

For many of the current discrete distributions a higher
precision survival probability is calculated.

For others, it is simply `1-cumulativeProbability`.

Many tests were added to verify the following:
- the precision of cumulativeProbability
- the precision of survivalProbability
- That survivalProbabiliy is near 1-cumulative
- That survival and cumulative probabilities are
  complementary

Through this development, certain distributions
were found lacking precision for their
cumulativeProbabilities and were improved.

These were:

- BinomialDistribution
- HypergeometricDistribuion

Expanding the tests for the Pascal distribution for the degenerate cases
found a bug in the p=1 degenerate case when x=0. The NaN return value
has been corrected to either 0 (x=0) or -infinity (x!=0).
15 files changed
tree: c32a357f6c5c08a1223f5f793ac312f7ec701284
  1. commons-statistics-distribution/
  2. commons-statistics-regression/
  3. dist-archive/
  4. src/
  5. .asf.yaml
  6. .gitattributes
  7. .gitignore
  8. .travis.yml
  9. CONTRIBUTING.md
  10. LICENSE.txt
  11. NOTICE.txt
  12. pom.xml
  13. README.md
README.md

Apache Commons Statistics

Build Status Coverage Status Maven Central License

The Apache Commons Statistics project provides tools for statistics.

Documentation

More information can be found on the Apache Commons Statistics homepage. The Javadoc can be browsed. Questions related to the usage of Apache Commons Statistics should be posted to the user mailing list.

Where can I get the latest release?

You can download source and binaries from our download page.

Alternatively you can pull it from the central Maven repositories:

<dependency>
  <groupId>org.apache.commons</groupId>
  <artifactId>commons-statistics</artifactId>
  <version>1.0</version>
</dependency>

Contributing

We accept Pull Requests via GitHub. The developer mailing list is the main channel of communication for contributors. There are some guidelines which will make applying PRs easier for us:

  • No tabs! Please use spaces for indentation.
  • Respect the code style.
  • Create minimal diffs - disable on save actions like reformat source code or organize imports. If you feel the source code should be reformatted create a separate PR for this change.
  • Provide JUnit tests for your changes and make sure your changes don't break any existing tests by running mvn clean test.

If you plan to contribute on a regular basis, please consider filing a contributor license agreement. You can learn more about contributing via GitHub in our contribution guidelines.

License

This code is under the Apache Licence v2.

See the NOTICE.txt file for required notices and attributions.

Donations

You like Apache Commons Statistics? Then donate back to the ASF to support the development.

Additional Resources