Use a single instance of the standard normal distribution

The distribution is immutable. The underlying computations use static
methods and can be used across threads.

Note: A micro-optimisation to eliminate the mean=0 and SD=1 from the
computations used from NormalDistribution(0, 1) has not been performed
to aid maintenance. It is presumed that multiplication by 1 or addition
of 0 is insignificant compared to the calls to:

- Math.exp (density)
- Erf.value (cumulativeProbability)
- InverseErf.value (inverseCumulativeProbability)

Only the logDensity function would be expected to improve performance as
it would eliminate 1 subtraction and 1 devision to leave the computation
as 2 multiplications and a subtraction:

return -0.5 * x * x - halfLog2Pi
1 file changed
tree: 03c854cb503c5d6666751e9f11649706653d485b
  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
  11. NOTICE
  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 file for required notices and attributions.

Donations

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

Additional Resources