User manual for root finding, distribution framework and special functions.
Contributed by: Brent Worden Reference: #23367, #23361, #23389 git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/math/trunk@140997 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
5971a93e3f
commit
2d04bb133a
|
@ -1,24 +1,25 @@
|
|||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<project name="Math">
|
||||
|
||||
<title>Math</title>
|
||||
<organizationLogo href="/images/jakarta-logo-blue.gif">Jakarta</organizationLogo>
|
||||
|
||||
<body>
|
||||
<menu name="Math">
|
||||
<item name="Overview" href="/index.html"/>
|
||||
<item name="Proposal" href="/proposal.html"/>
|
||||
<item name="Developers Guide" href="/developers.html"/>
|
||||
<item name="Tasks: Done And To Do" href="/tasks.html"/>
|
||||
</menu>
|
||||
<menu name="User Guide">
|
||||
<item name="Contents" href="/userguide/index.html"/>
|
||||
<item name="Overview" href="/userguide/overview.html"/>
|
||||
<item name="Statistics" href="/userguide/stat.html"/>
|
||||
<item name="Data generation" href="/userguide/random.html"/>
|
||||
<item name="Linear Algebra" href="/userguide/linear.html"/>
|
||||
<item name="Special Functions" href="/userguide/special.html"/>
|
||||
<item name="Utilities" href="/userguide/utilities.html"/>
|
||||
</menu>
|
||||
</body>
|
||||
</project>
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<!-- $Revision: 1.3 $ $Date: 2003/09/24 20:15:50 $ -->
|
||||
<project name="Math">
|
||||
|
||||
<title>Math</title>
|
||||
<organizationLogo href="/images/jakarta-logo-blue.gif">Jakarta</organizationLogo>
|
||||
|
||||
<body>
|
||||
<menu name="Math">
|
||||
<item name="Overview" href="/index.html"/>
|
||||
<item name="Proposal" href="/proposal.html"/>
|
||||
<item name="Developers Guide" href="/developers.html"/>
|
||||
<item name="Tasks: Done And To Do" href="/tasks.html"/>
|
||||
</menu>
|
||||
<menu name="User Guide">
|
||||
<item name="Contents" href="/userguide/index.html"/>
|
||||
<item name="Overview" href="/userguide/overview.html"/>
|
||||
<item name="Statistics" href="/userguide/stat.html"/>
|
||||
<item name="Data generation" href="/userguide/random.html"/>
|
||||
<item name="Linear Algebra" href="/userguide/linear.html"/>
|
||||
<item name="Special Functions" href="/userguide/special.html"/>
|
||||
<item name="Utilities" href="/userguide/utilities.html"/>
|
||||
</menu>
|
||||
</body>
|
||||
</project>
|
||||
|
|
151
xdocs/tasks.xml
151
xdocs/tasks.xml
|
@ -1,78 +1,79 @@
|
|||
<?xml version="1.0"?>
|
||||
<!-- $Revision: 1.8 $ $Date: 2003/09/24 20:15:50 $ -->
|
||||
<document>
|
||||
<properties>
|
||||
<title>Tasks: Done And To Do</title>
|
||||
</properties>
|
||||
<body>
|
||||
<section name="Aim">
|
||||
<p>This page aims to be a handy reference not only of the work done but also of work pending for the next planned release. Users who want new features should submit patches to this page in the unclassified section of this document. Developers who want to lend a hand can grab tasks from this page. Everyone can see the progress which is being made.</p>
|
||||
</section>
|
||||
<section name="TODO list">
|
||||
<p>The following is a list of items still <code>TODO</code> for Math. Contributions are welcome!</p>
|
||||
<subsection name="Documentation and Code Conformance Tasks">
|
||||
<p>Many of these will always be a required. Please focus on applying format standards and provide as many test cases as possible for your code.</p>
|
||||
<dl>
|
||||
<dt>Develop user's guide following the package structure.</dt>
|
||||
<dd>Provide any comments on this task here.</dd>
|
||||
<dt>Performance and accuracy testing.</dt>
|
||||
<dd>If anyone is interested in helping out here, what we could really use is a wider selection of test cases for the core numerical functions and validation against either other packages (e.g. R for the statistical stuff), verified datasets, or experiments comparing implementions using floats to doubles.</dd>
|
||||
<dt>Test Coverage.</dt>
|
||||
<dd>Clover tests show gaps in test path coverage. Get all tests to 100% coverage. Also improve test data and boundary conditions coverage.</dd>
|
||||
<dt>Code review.</dt>
|
||||
<dd>
|
||||
<p>Code review is a continuous rpocess that all Contributors and Developers should practice while working on the code base.</p>
|
||||
<ul>
|
||||
<li>Javadoc generation is still throwing warnings. Bring the Javadoc into compliance (i.e. reach zero warnings).</li>
|
||||
<li>Verify that the code matches the documentation and identify obvious inefficiencies or numerical problems. All feedback/suggestions for improvement/patches are welcome.</li>
|
||||
<li>CheckStyle with modified properties still shows many errors. Try to clean these up.</li>
|
||||
</ul>
|
||||
</dd>
|
||||
</dl>
|
||||
</subsection>
|
||||
<subsection name="Algorithm Development Tasks">
|
||||
<p>These current tasks are planned and in need completion for the inital release.</p>
|
||||
<dl>
|
||||
<dt>Add confidence intervals to Univariate implementations.</dt>
|
||||
<dd>Provide any comments on this task here.</dd>
|
||||
<dt>Distributions.</dt>
|
||||
<dd>Extend distribution framework to support discrete distributions and implement binomial and hypergeometric distributions.</dd>
|
||||
<dt>Analysis.</dt>
|
||||
<dd>
|
||||
<ul>
|
||||
<li>Framework and implementation strategie(s) for finding roots or real-valued functions of one (real) variable.</li>
|
||||
<li>Cubic spline interpolation.</li>
|
||||
<li>CheckStyle with modified properties still shows many errors. Try to clean these up.</li>
|
||||
</ul>
|
||||
</dd>
|
||||
<dt>Distributions.</dt>
|
||||
<dd>Finalize the contents of MathUtils and StatUtils. Suggest any additions -- ideally with patches -- to these utility classes.</dd>
|
||||
</dl>
|
||||
</subsection>
|
||||
</section>
|
||||
<section name="Future Goals">
|
||||
<subsection name="Delayed Tasks">
|
||||
<p>While we are interested in implementing these aspects of the library, we have decided to hold off on their development at this time.</p>
|
||||
<dl>
|
||||
<dt>Complex Number Library.</dt>
|
||||
<dd>Add comments here.</dd>
|
||||
</dl>
|
||||
</subsection>
|
||||
</section>
|
||||
<section name="Completed">
|
||||
<subsection name="Since Conception">
|
||||
<ul>
|
||||
<li>Bivariate Regression, correlation. </li>
|
||||
<li>Sampling from Collections</li>
|
||||
<li>Add higher order moments to Univariate implementations.</li>
|
||||
<li>Binomial coefficients -- incorporate an "exact" implementation that is limited to what can be stored in a long. Also provided double-value implementation of binomial coefficients and their logs.</li>
|
||||
<li>Add percentiles to stored Univariate implementations</li>
|
||||
<li>Improve numerical accuracy of Univariate and BivariateRegression statistical computations</li>
|
||||
<li>t-test statistic needs to be added and we should probably add the capability of actually performing t- and chi-square tests at fixed significance levels (.1, .05, .01, .001).</li>
|
||||
<li>numerical approximation of the t- and chi-square distributions to enable user-supplied significance levels.</li>
|
||||
<li>The RealMatrixImpl class is missing some key method implementations. The critical thing is solution of linear systems. We need to implement a numerically sound solution algorithm. This will enable inverse() and also support general linear regression.</li>
|
||||
<li>Added double[] |-> double methods in StatUtils to take start indexes and length as parameters and delegate the current "full array" versions to these.</li>
|
||||
</ul>
|
||||
</subsection>
|
||||
</section>
|
||||
</body>
|
||||
<properties>
|
||||
<title>Tasks: Done And To Do</title>
|
||||
</properties>
|
||||
<body>
|
||||
<section name="Aim">
|
||||
<p>This page aims to be a handy reference not only of the work done but also of work pending for the next planned release. Users who want new features should submit patches to this page in the unclassified section of this document. Developers who want to lend a hand can grab tasks from this page. Everyone can see the progress which is being made.</p>
|
||||
</section>
|
||||
<section name="TODO list">
|
||||
<p>The following is a list of items still <code>TODO</code> for Math. Contributions are welcome!</p>
|
||||
<subsection name="Documentation and Code Conformance Tasks">
|
||||
<p>Many of these will always be a required. Please focus on applying format standards and provide as many test cases as possible for your code.</p>
|
||||
<dl>
|
||||
<dt>Develop user's guide following the package structure.</dt>
|
||||
<dd>Provide any comments on this task here.</dd>
|
||||
<dt>Performance and accuracy testing.</dt>
|
||||
<dd>If anyone is interested in helping out here, what we could really use is a wider selection of test cases for the core numerical functions and validation against either other packages (e.g. R for the statistical stuff), verified datasets, or experiments comparing implementions using floats to doubles.</dd>
|
||||
<dt>Test Coverage.</dt>
|
||||
<dd>Clover tests show gaps in test path coverage. Get all tests to 100% coverage. Also improve test data and boundary conditions coverage.</dd>
|
||||
<dt>Code review.</dt>
|
||||
<dd>
|
||||
<p>Code review is a continuous rpocess that all Contributors and Developers should practice while working on the code base.</p>
|
||||
<ul>
|
||||
<li>Javadoc generation is still throwing warnings. Bring the Javadoc into compliance (i.e. reach zero warnings).</li>
|
||||
<li>Verify that the code matches the documentation and identify obvious inefficiencies or numerical problems. All feedback/suggestions for improvement/patches are welcome.</li>
|
||||
<li>CheckStyle with modified properties still shows many errors. Try to clean these up.</li>
|
||||
</ul>
|
||||
</dd>
|
||||
</dl>
|
||||
</subsection>
|
||||
<subsection name="Algorithm Development Tasks">
|
||||
<p>These current tasks are planned and in need completion for the inital release.</p>
|
||||
<dl>
|
||||
<dt>Add confidence intervals to Univariate implementations.</dt>
|
||||
<dd>Provide any comments on this task here.</dd>
|
||||
<dt>Distributions.</dt>
|
||||
<dd>Extend distribution framework to support discrete distributions and implement binomial and hypergeometric distributions.</dd>
|
||||
<dt>Analysis.</dt>
|
||||
<dd>
|
||||
<ul>
|
||||
<li>Framework and implementation strategie(s) for finding roots or real-valued functions of one (real) variable.</li>
|
||||
<li>Cubic spline interpolation.</li>
|
||||
<li>CheckStyle with modified properties still shows many errors. Try to clean these up.</li>
|
||||
</ul>
|
||||
</dd>
|
||||
<dt>Distributions.</dt>
|
||||
<dd>Finalize the contents of MathUtils and StatUtils. Suggest any additions -- ideally with patches -- to these utility classes.</dd>
|
||||
</dl>
|
||||
</subsection>
|
||||
</section>
|
||||
<section name="Future Goals">
|
||||
<subsection name="Delayed Tasks">
|
||||
<p>While we are interested in implementing these aspects of the library, we have decided to hold off on their development at this time.</p>
|
||||
<dl>
|
||||
<dt>Complex Number Library.</dt>
|
||||
<dd>Add comments here.</dd>
|
||||
</dl>
|
||||
</subsection>
|
||||
</section>
|
||||
<section name="Completed">
|
||||
<subsection name="Since Conception">
|
||||
<ul>
|
||||
<li>Bivariate Regression, correlation. </li>
|
||||
<li>Sampling from Collections</li>
|
||||
<li>Add higher order moments to Univariate implementations.</li>
|
||||
<li>Binomial coefficients -- incorporate an "exact" implementation that is limited to what can be stored in a long. Also provided double-value implementation of binomial coefficients and their logs.</li>
|
||||
<li>Add percentiles to stored Univariate implementations</li>
|
||||
<li>Improve numerical accuracy of Univariate and BivariateRegression statistical computations</li>
|
||||
<li>t-test statistic needs to be added and we should probably add the capability of actually performing t- and chi-square tests at fixed significance levels (.1, .05, .01, .001).</li>
|
||||
<li>numerical approximation of the t- and chi-square distributions to enable user-supplied significance levels.</li>
|
||||
<li>The RealMatrixImpl class is missing some key method implementations. The critical thing is solution of linear systems. We need to implement a numerically sound solution algorithm. This will enable inverse() and also support general linear regression.</li>
|
||||
<li>Added double[] |-> double methods in StatUtils to take start indexes and length as parameters and delegate the current "full array" versions to these.</li>
|
||||
</ul>
|
||||
</subsection>
|
||||
</section>
|
||||
</body>
|
||||
</document>
|
||||
|
|
|
@ -1,34 +1,85 @@
|
|||
<?xml version="1.0"?>
|
||||
<document url="analysis.html">
|
||||
|
||||
<properties>
|
||||
<title>The Commons Math User Guide - Numerical Analysis</title>
|
||||
<author email="phil@steitz.com">Phil Steitz</author>
|
||||
</properties>
|
||||
|
||||
<body>
|
||||
|
||||
<section name="4 Numerical Analysis">
|
||||
|
||||
<subsection name="4.1 Overview" href="overview">
|
||||
<p>
|
||||
This is yet to be written. Any contributions will be gratefully accepted!
|
||||
</p>
|
||||
</subsection>
|
||||
|
||||
<subsection name="4.2 Root-finding" href="rootfinding">
|
||||
<p>
|
||||
This is yet to be written. Any contributions will be gratefully accepted!
|
||||
</p>
|
||||
</subsection>
|
||||
|
||||
<subsection name="4.3 Interpolation" href="interpolation">
|
||||
<p>
|
||||
This is yet to be written. Any contributions will be gratefully accepted!
|
||||
</p>
|
||||
</subsection>
|
||||
|
||||
</section>
|
||||
|
||||
</body>
|
||||
</document>
|
||||
<?xml version="1.0"?>
|
||||
<!-- $Revision: 1.2 $ $Date: 2003/09/24 20:15:50 $ -->
|
||||
<document url="analysis.html">
|
||||
<properties>
|
||||
<title>The Commons Math User Guide - Numerical Analysis</title>
|
||||
<author email="phil@steitz.com">Phil Steitz</author>
|
||||
</properties>
|
||||
<body>
|
||||
<section name="4 Numerical Analysis">
|
||||
<subsection name="4.1 Overview" href="overview">
|
||||
<p>This is yet to be written. Any contributions will be gratefully
|
||||
accepted!</p>
|
||||
</subsection>
|
||||
<subsection name="4.2 Root-finding" href="rootfinding">
|
||||
<p>
|
||||
<code>org.apache.commons.math.analysis.UnivariateRealSolver</code> provides the means to
|
||||
find roots of univariate, real valued, functions. Commons-Math supports various
|
||||
implementations of <code>UnivariateRealSolver</code> to solve functions with differing
|
||||
characteristics.
|
||||
</p>
|
||||
<p>
|
||||
In order to use the root-finding features, first a solver object must be created. It is
|
||||
encouraged that all solver object creation occurs via the <code>org.apache.commons.math.analysis.UnivariateRealSolverFactory</code>
|
||||
class. <code>UnivariateRealSolverFactory</code> is a simple factory used to create all
|
||||
of the solver objects supported by Commons-Math. The typical usage of <code>UnivariateRealSolverFactory</code>
|
||||
to create a solver object would be:</p>
|
||||
<source>UnivariateRealFunction function = // some user defined function object
|
||||
UnivariateRealSolverFactory factory = UnivariateRealSolverFactory.newInstance();
|
||||
UnivariateRealSolver solver = factory.newDefaultSolver(function);</source>
|
||||
<p>
|
||||
The solvers that can be instantiated via the <code>UnivariateRealSolverFactory</code> are detailed below:
|
||||
<table>
|
||||
<tr><th>Solver</th><th>Factory Method</th><th>Notes on Use</th></tr>
|
||||
<tr><td>Bisection</td><td>newBisectionSolver</td><td><div>Root must be bracketted.</div><div>Linear, guaranteed convergence</div></td></tr>
|
||||
<tr><td>Brent</td><td>newBrentSolver</td><td><div>Root must be bracketted.</div><div>Super-linear, guaranteed convergence</div></td></tr>
|
||||
<tr><td>Secant</td><td>newSecantSolver</td><td><div>Root must be bracketted.</div><div>Super-linear, non-guaranteed convergence</div></td></tr>
|
||||
</table>
|
||||
</p>
|
||||
<p>
|
||||
Using a solver object, roots of functions are easily found using the <code>solve</code>
|
||||
methods. For a function <code>f</code>, and two domain values, <code>min</code> and
|
||||
<code>max</code>, <code>solve</code> computes the value <code>c</code> such that:
|
||||
<ul>
|
||||
<li><code>f(c) = 0.0</code></li>
|
||||
<li><code>min <= c <= max</code></li>
|
||||
</ul>
|
||||
</p>
|
||||
<source>UnivariateRealFunction function = // some user defined function object
|
||||
UnivariateRealSolverFactory factory = UnivariateRealSolverFactory.newInstance();
|
||||
UnivariateRealSolver solver = factory.newBisectionSolver(function);
|
||||
double c = solver.solve(1.0, 5.0);</source>
|
||||
<p>
|
||||
Along with the <code>solve</code> methods, the <code>UnivariateRealSolver</code>
|
||||
interface provides many properties to control the convergence of a solver. For the most
|
||||
part, these properties should not have to change from their default values to produce
|
||||
quality results. In the circumstances where changing these property values is needed, it
|
||||
is easily done through getter and setter methods on <code>UnivariateRealSolver</code>:
|
||||
<table>
|
||||
<tr><th>Property</th><th>Methods</th><th>Purpose</th></tr>
|
||||
<tr><td>Absolute accuracy</td><td>
|
||||
<div>getAbsoluteAccuracy</div>
|
||||
<div>resetAbsoluteAccuracy</div>
|
||||
<div>setAbsoluteAccuracy</div></td><td>This is yet to be written. Any contributions will be greatfully accepted!</td></tr>
|
||||
<tr><td>Function value accuracy</td><td>
|
||||
<div>getFunctionValueAccuracy</div>
|
||||
<div>resetFunctionValueAccuracy</div>
|
||||
<div>setFunctionValueAccuracy</div></td><td>This is yet to be written. Any contributions will be greatfully accepted!</td></tr>
|
||||
<tr><td>Maximum iteration count</td><td>
|
||||
<div>getMaximumIterationCount</div>
|
||||
<div>resetMaximumIterationCount</div>
|
||||
<div>setMaximumIterationCount</div></td><td>This is yet to be written. Any contributions will be greatfully accepted!</td></tr>
|
||||
<tr><td>Relative accuracy</td><td>
|
||||
<div>getRelativeAccuracy</div>
|
||||
<div>resetRelativeAccuracy</div>
|
||||
<div>setRelativeAccuracy</div></td><td>This is yet to be written. Any contributions will be greatfully accepted!</td></tr>
|
||||
</table>
|
||||
</p>
|
||||
</subsection>
|
||||
<subsection name="4.3 Interpolation" href="interpolation">
|
||||
<p>This is yet to be written. Any contributions will be gratefully
|
||||
accepted!</p>
|
||||
</subsection>
|
||||
</section>
|
||||
</body>
|
||||
</document>
|
||||
|
|
|
@ -1,34 +1,40 @@
|
|||
<?xml version="1.0"?>
|
||||
<document url="special.html">
|
||||
|
||||
<properties>
|
||||
<title>The Commons Math User Guide - Special Functions</title>
|
||||
<author email="phil@steitz.com">Phil Steitz</author>
|
||||
</properties>
|
||||
|
||||
<body>
|
||||
|
||||
<section name="5 Special Functions">
|
||||
|
||||
<subsection name="5.1 Overview" href="overview">
|
||||
<p>
|
||||
This is yet to be written. Any contributions will be gratefully accepted!
|
||||
</p>
|
||||
</subsection>
|
||||
|
||||
<subsection name="5.2 Gamma functions" href="gamma">
|
||||
<p>
|
||||
This is yet to be written. Any contributions will be gratefully accepted!
|
||||
</p>
|
||||
</subsection>
|
||||
|
||||
<subsection name="5.3 Beta funtions" href="beta">
|
||||
<p>
|
||||
This is yet to be written. Any contributions will be gratefully accepted!
|
||||
</p>
|
||||
</subsection>
|
||||
|
||||
</section>
|
||||
|
||||
</body>
|
||||
</document>
|
||||
<?xml version="1.0"?>
|
||||
<!-- $Revision: 1.2 $ $Date: 2003/09/24 20:15:50 $ -->
|
||||
<document url="special.html">
|
||||
<properties>
|
||||
<title>The Commons Math User Guide - Special Functions</title>
|
||||
<author email="phil@steitz.com">Phil Steitz</author>
|
||||
</properties>
|
||||
<body>
|
||||
<section name="5 Special Functions">
|
||||
<subsection name="5.1 Overview" href="overview">
|
||||
<p>
|
||||
The special functions portion of Commons-Math contains several useful functions not
|
||||
provided by <code>java.lang.Math</code>. These functions mostly serve as building blocks
|
||||
for other portions of Commons-Math but, as others may find them useful as stand-alone
|
||||
methods, these special functions were included as part of the Commons-Math public API.
|
||||
</p>
|
||||
</subsection>
|
||||
<subsection name="5.2 Gamma functions" href="gamma">
|
||||
<p>
|
||||
<code>org.apache.commons.math.special.Gamma</code> contains several useful functions involving the Gamma Function.
|
||||
<table>
|
||||
<tr><th>Function</th><th>Method</th><th>Reference</th></tr>
|
||||
<tr><td>Log Gamma</td><td>logGamma</td><td>See <a href="http://mathworld.wolfram.com/GammaFunction.html">Gamma Function</a> from MathWorld</td></tr>
|
||||
<tr><td>Regularized Gamma</td><td>regularizedGammaP</td><td>See <a href="http://mathworld.wolfram.com/RegularizedGammaFunction.html">Regularized Gamma Function</a> from MathWorld</td></tr>
|
||||
</table>
|
||||
</p>
|
||||
</subsection>
|
||||
<subsection name="5.3 Beta funtions" href="beta">
|
||||
<p>
|
||||
<code>org.apache.commons.math.special.Beta</code> contains several useful functions involving the Beta Function.
|
||||
<table>
|
||||
<tr><th>Function</th><th>Method</th><th>Reference</th></tr>
|
||||
<tr><td>Log Beta</td><td>logBeta</td><td>See <a href="http://mathworld.wolfram.com/BetaFunction.html">Beta Function</a> from MathWorld</td></tr>
|
||||
<tr><td>Regularized Beta</td><td>regularizedBeta</td><td>See <a href="http://mathworld.wolfram.com/RegularizedBetaFunction.html">Regularized Beta Function</a> from MathWorld</td></tr>
|
||||
</table>
|
||||
</p>
|
||||
</subsection>
|
||||
</section>
|
||||
</body>
|
||||
</document>
|
||||
|
|
|
@ -1,52 +1,91 @@
|
|||
<?xml version="1.0"?>
|
||||
<document url="stat.html">
|
||||
|
||||
<properties>
|
||||
<title>The Commons Math User Guide - Statistics</title>
|
||||
<author email="phil@steitz.com">Phil Steitz</author>
|
||||
</properties>
|
||||
|
||||
<body>
|
||||
|
||||
<section name="1 Statistics">
|
||||
|
||||
<subsection name="1.1 Overview" href="overview">
|
||||
<p>
|
||||
This is yet to be written. Any contributions will be greatfully accepted!
|
||||
</p>
|
||||
</subsection>
|
||||
|
||||
<subsection name="1.2 Univariate statistics" href="univariate">
|
||||
<p>
|
||||
This is yet to be written. Any contributions will be gratefully accepted!
|
||||
</p>
|
||||
</subsection>
|
||||
|
||||
<subsection name="1.3 Frequency distributions" href="frequency">
|
||||
<p>
|
||||
This is yet to be written. Any contributions will be gratefully accepted!
|
||||
</p>
|
||||
</subsection>
|
||||
|
||||
<subsection name="1.4 Bivariate regression" href="regression">
|
||||
<p>
|
||||
This is yet to be written. Any contributions will be gratefully accepted!
|
||||
</p>
|
||||
</subsection>
|
||||
|
||||
<subsection name="1.5 Statistical tests" href="tests">
|
||||
<p>
|
||||
This is yet to be written. Any contributions will be gratefully accepted!
|
||||
</p>
|
||||
</subsection>
|
||||
|
||||
<subsection name="1.6 Distribution framework" href="distributions">
|
||||
<p>
|
||||
This is yet to be written. Any contributions will be gratefully accepted!
|
||||
</p>
|
||||
</subsection>
|
||||
|
||||
</section>
|
||||
|
||||
</body>
|
||||
</document>
|
||||
<?xml version="1.0"?>
|
||||
<!-- $Revision: 1.2 $ $Date: 2003/09/24 20:15:50 $ -->
|
||||
<document url="stat.html">
|
||||
<properties>
|
||||
<title>The Commons Math User Guide - Statistics</title>
|
||||
<author email="phil@steitz.com">Phil Steitz</author>
|
||||
</properties>
|
||||
<body>
|
||||
<section name="1 Statistics">
|
||||
<subsection name="1.1 Overview" href="overview">
|
||||
<p>This is yet to be written. Any contributions will be greatfully
|
||||
accepted!</p>
|
||||
</subsection>
|
||||
<subsection name="1.2 Univariate statistics" href="univariate">
|
||||
<p>This is yet to be written. Any contributions will be gratefully
|
||||
accepted!</p>
|
||||
</subsection>
|
||||
<subsection name="1.3 Frequency distributions" href="frequency">
|
||||
<p>This is yet to be written. Any contributions will be gratefully
|
||||
accepted!</p>
|
||||
</subsection>
|
||||
<subsection name="1.4 Bivariate regression" href="regression">
|
||||
<p>This is yet to be written. Any contributions will be gratefully
|
||||
accepted!</p>
|
||||
</subsection>
|
||||
<subsection name="1.5 Statistical tests" href="tests">
|
||||
<p>This is yet to be written. Any contributions will be gratefully
|
||||
accepted!</p>
|
||||
</subsection>
|
||||
<subsection name="1.6 Distribution framework" href="distributions">
|
||||
<p>
|
||||
The distribution framework provides the means to compute probability density
|
||||
function (PDF) probabilities and cumulative distribution function (CDF)
|
||||
probabilities for common probability distributions. Along with the direct
|
||||
computation of PDF and CDF probabilities, the framework also allows for the
|
||||
computation of inverse PDF and inverse CDF values.
|
||||
</p>
|
||||
<p>
|
||||
In order to use the distribution framework, first a distribution object must
|
||||
be created. It is encouraged that all distribution object creation occurs via
|
||||
the <code>org.apache.commons.math.stat.distribution.DistributionFactory</code>
|
||||
class. <code>DistributionFactory</code> is a simple factory used to create all
|
||||
of the distribution objects supported by Commons-Math. The typical usage of
|
||||
<code>DistributionFactory</code> to create a distribution object would be:
|
||||
</p>
|
||||
<source>DistributionFactory factory = DistributionFactory.newInstance();
|
||||
BinomialDistribution binomial = factory.createBinomialDistribution(10, .75);</source>
|
||||
<p>
|
||||
The distributions that can be instantiated via the <code>DistributionFactory</code>
|
||||
are detailed below:
|
||||
<table>
|
||||
<tr><th>Distribution</th><th>Factory Method</th><th>Parameters</th></tr>
|
||||
<tr><td>Binomial</td><td>createBinomialDistribution</td><td><div>Number of trials</div><div>Probability of success</div></td></tr>
|
||||
<tr><td>Chi-Squared</td><td>createChiSquaredDistribution</td><td><div>Degrees of freedom</div></td></tr>
|
||||
<tr><td>Exponential</td><td>createExponentialDistribution</td><td><div>Mean</div></td></tr>
|
||||
<tr><td>F</td><td>createFDistribution</td><td><div>Numerator degrees of freedom</div><div>Denominator degrees of freedom</div></td></tr>
|
||||
<tr><td>Gamma</td><td>createGammaDistribution</td><td><div>Alpha</div><div>Beta</div></td></tr>
|
||||
<tr><td>Hypergeometric</td><td>createHypogeometricDistribution</td><td><div>Population size</div><div>Number of successes in population</div><div>Sample size</div></td></tr>
|
||||
<tr><td>t</td><td>createTDistribution</td><td><div>Degrees of freedom</div></td></tr>
|
||||
</table>
|
||||
</p>
|
||||
<p>
|
||||
Using a distribution object, PDF and CDF probabilities are easily computed
|
||||
using the <code>cummulativeProbability</code> methods. For a distribution <code>X</code>,
|
||||
and a domain value, <code>x</code>, <code>cummulativeProbability</code> computes
|
||||
<code>P(X <= x)</code> (i.e. the lower tail probability of <code>X</code>).
|
||||
</p>
|
||||
<source>DistributionFactory factory = DistributionFactory.newInstance();
|
||||
TDistribution t = factory.createBinomialDistribution(29);
|
||||
double lowerTail = t.cummulativeProbability(-2.656); // P(T <= -2.656)
|
||||
double upperTail = 1.0 - t.cummulativeProbability(2.75); // P(T >= 2.75)</source>
|
||||
<p>
|
||||
The inverse PDF and CDF values are just as easily computed using the
|
||||
<code>inverseCummulativeProbability</code>methods. For a distribution <code>X</code>,
|
||||
and a probability, <code>p</code>, <code>inverseCummulativeProbability</code>
|
||||
computes the domain value <code>x</code>, such that:
|
||||
<ul>
|
||||
<li><code>P(X <= x) = p</code>, for continuous distributions</li>
|
||||
<li><code>P(X <= x) <= p</code>, for discrete distributions</li>
|
||||
</ul>
|
||||
Notice the different cases for continuous and discrete distributions. This is the result
|
||||
of PDFs not being invertible functions. As such, for discrete distributions, an exact
|
||||
domain value can not be returned. Only the "best" domain value. For Commons-Math, the "best"
|
||||
domain value is determined by the largest domain value whose cummulative probability is
|
||||
less-than or equal to the given probability.
|
||||
</p>
|
||||
</subsection>
|
||||
|
||||
</section>
|
||||
</body>
|
||||
</document>
|
||||
|
|
Loading…
Reference in New Issue