FPL Statistics Group
Probability Distributions Java Package
Currently (as 2/12/03) this package contains
Java methods that permit a user to calculate 2 parameter Weibull,
3 parameter Weibull, Normal, and Noncentral T cumulative distribution
functions and their inverses. It also contains methods to calculate
the error function and the complementary error function. Most of the
methods are translations of FORTRAN
routines written by others.
At some point I intend to add Chi-Squared and F distribution (both
central and noncentral) material. If you are aware of high quality
probability distribution routines written in Java, I would appreciate
hearing about them. Please e-mail me (Steve Verrill) at
sverrill@fs.fed.us.
Warning!!!
- This work was performed by a user of numerical analysis
routines rather than a developer. When probability distribution routines
written in Java by professional
numerical analysts become
available, they should be used.
- I have tried to be careful with the coding and have done some
simple testing (see the
CDF_Normal_Amos_Test,
CDF_Normal_Test,
CDF_Weibull2_Test,
CDF_Weibull3_Test,
DerfTest,
NctTest, and
Nct_invTest
applications).
However, it is quite possible that I have introduced
errors into the routines in the course of the translations. If you
detect bugs in these routines, PLEASE contact me
(Steve Verrill at sverrill@fs.fed.us
or 608-231-9375).
DISCLAIMER OF WARRANTIES
THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND.
THE AUTHOR/TRANSLATOR DOES NOT WARRANT, GUARANTEE OR MAKE ANY
REPRESENTATIONS REGARDING THE SOFTWARE OR DOCUMENTATION IN TERMS
OF THEIR CORRECTNESS, RELIABILITY, CURRENTNESS, OR OTHERWISE.
THE ENTIRE RISK AS TO THE RESULTS AND PERFORMANCE OF THE SOFTWARE
IS ASSUMED BY YOU. IN NO CASE WILL ANY PARTY INVOLVED WITH THE
CREATION OR DISTRIBUTION OF THE SOFTWARE BE LIABLE FOR ANY DAMAGE
THAT MAY RESULT FROM THE USE OF THIS SOFTWARE.
Sorry about that.
Documentation
Here is the
documentation generated by
javadoc. Also see the source code of the routines.
CDF_Normal.java
CDF_Normal.java contains two methods. The normp method
calculates the normal cumulative distribution function (cdf). It
is claimed to be accurate to within 1.0e-15. It is a translation
of a routine written in FORTRAN in 1986 by Alan Miller.
It is based on algorithm 5666 from Computer Approximations
by J.F. Hart and others (Wiley, 1968). The xnormi method calculates
the inverse of the normal cdf. It is claimed to be accurate to
within 4.5e-4. It was written in June of 1996 by Steve Verrill.
It is based on formula 26.2.23 on page 933 of
Abramowitz and Stegun's
Handbook of Mathematical Functions (Dover, 9th printing).
CDF_Normal_Amos.java
CDF_Normal_Amos.java contains one method. The fnorm method
calculates the normal cumulative distribution function. It
is claimed to be accurate to within 1.0e-13. It is a translation
of a routine written in FORTRAN in 1974 by Don Amos and S.L. Daniel.
CDF_Weibull2.java
CDF_Weibull2.java contains two methods. The w2cdf method
calculates the 2 parameter Weibull cdf. The w2inv method
calculates the inverse of the 2 parameter Weibull cdf. Both
methods were written by Steve Verrill in 2001.
CDF_Weibull3.java
CDF_Weibull3.java contains two methods. The w3cdf method
calculates the 3 parameter Weibull cdf. The w3inv method
calculates the inverse of the 3 parameter Weibull cdf. Both
methods were written by Steve Verrill in 2001.
CDF_nct_Amos.java
CDF_nct_Amos.java contains three main methods.
The fnct method
calculates the noncentral T cdf. It is a translation of a routine
written in FORTRAN in 1972 (modified in 1991) by D.E. Amos and
S.L. Daniel. It references "A Survey of Properties and Applications
of the Non-central T Distribution" by D.B. Owen, Technometrics,
10, no. 3, pages 464-465.
The fnct_inv method calculates the inverse of the noncentral T cdf.
It should be accurate to 1.0e-5. It was written by Steve Verrill in
2002.
The tha method computes the t(h,a) integral of Owen.
It is a translation of a routine written in FORTRAN in 1975 by
D.E. Amos and S.L. Daniel.
Derf.java
Derf.java contains two main methods. Both are translations of FORTRAN
routines written in 1977 (last updated in 1992) by W. Fullerton
of Los Alamos National Laboratory. The method derf calculates the
error function. The method derfc calculates the complementary
error function.
Installation
The code is available in
compressed tar,
Windows 95 zip,
and Windows 98 and later zip, form.
Alternatively, the code comes in nineteen files:
- CDF_Normal.java
- CDF_Normal_Amos.java
- CDF_Weibull2.java
- CDF_Weibull3.java
- CDF_nct_Amos.java
- Derf.java
- CDF_Normal_Test.java
- CDF_Normal_Amos_Test.java
- CDF_Weibull2_Test.java
- CDF_Weibull3_Test.java
- NctTest.java
- Nct_invTest.java
- DerfTest.java
- Fzero.java
- Fzero_methods.java
- Gaus8.java
- Gaus8_fcn.java
- Blas_f77.java
- Console.java
Given the manner in which the routines are currently written,
you will need to import them (see, for example, the beginning of
CDF_nct_Amos.java). All of the classes
will have to be placed
in subdirectories of a directory in your CLASSPATH.
The Fzero and Fzero_methods classes will have to be placed
in a subdirectory called optimization.
The Gaus8 and Gaus8_fcn classes will have to be placed
in a subdirectory called quadrature.
The Blas_f77 class will have to be placed in a subdirectory
called linear_algebra.
Console.class
will have to be placed in a
subdirectory called corejava. The remaining classes will have to be
placed in a subdirectory called distributions.
Note that if you install the software in this manner,
then to run, for example, NctTest you will have to issue the command:
java distributions.NctTest
Alternatively, you could remove the package and import statements
(other than import java.lang.*) in the source code,
and compile all of the necessary files in the same directory.
Console.java
Console.java is software described in Cornell
and Horstmann's Core Java (SunSoft Press/Prentice-Hall).
(I like this book.)
It may be used for non-commerical purposes. I
only make use of it in the testing routines.
Support
If you have questions about this software,
or suggestions for improvement,
please contact me at
sverrill@fs.fed.us
or 608-231-9375.
[Forest Service]
[Forest Products
Lab]
[FPL Statistics Group]
Last modified on 2/12/03.
As of last midnight, this page had been accessed




times.