gov.sandia.cognition.statistics.distribution
Class StudentizedRangeDistribution.APStat

java.lang.Object
  extended by gov.sandia.cognition.statistics.distribution.StudentizedRangeDistribution.APStat
Enclosing class:
StudentizedRangeDistribution

public static class StudentizedRangeDistribution.APStat
extends Object

This is a translation of Fortran code taken from http://lib.stat.cmu.edu/apstat/, and the comments on the individual functions in this class are taken directly from the original.


Constructor Summary
StudentizedRangeDistribution.APStat()
           
 
Method Summary
static double alnorm(double x, boolean upper)
          Algorithm AS66 Applied Statistics (1973) vol22 no.3.
static double ppnd(double p)
          ALGORITHM AS 111, APPL.STATIST., VOL.26, 118-121, 1977.
static double prtrng(double q, double v, double r)
          Algorithm AS 190 Appl Statist (1983) Vol.32, No.2.
static double qtrng(double p, double v, double r)
          Algorithm AS 190.1 Appl Statist (1983) Vol.32, No.2.
static double qtrng0(double p, double v, double r)
          Algorithm AS 190.2 Appl Statist (1983) Vol.32, No.2.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StudentizedRangeDistribution.APStat

public StudentizedRangeDistribution.APStat()
Method Detail

alnorm

public static double alnorm(double x,
                            boolean upper)
Algorithm AS66 Applied Statistics (1973) vol22 no.3. Evaluates the tail area of the standardised normal curve from x to infinity if upper is .true. or from minus infinity to x if upper is .false.

Parameters:
x - Location for which to compute tail area
upper - True to find upper tail area, false to find lower tail area
Returns:
Tail area for given x

ppnd

public static double ppnd(double p)
ALGORITHM AS 111, APPL.STATIST., VOL.26, 118-121, 1977. PRODUCES NORMAL DEVIATE CORRESPONDING TO LOWER TAIL AREA = P. See also AS 241 which contains alternative routines accurate to about 7 and 16 decimal digits.

Parameters:
p - P-value for which to compute normal deviate
Returns:
Normal deviate corresponding to lower tail area = p

prtrng

public static double prtrng(double q,
                            double v,
                            double r)
Algorithm AS 190 Appl Statist (1983) Vol.32, No.2. Incorporates corrections from Appl. Statist. (1985) Vol.34 (1) Evaluates the probability from 0 to q for a studentized range having v degrees of freedom and r samples. Uses subroutine ALNORM = algorithm AS66. Arrays vw and qw store transient values used in the quadrature summation. Node spacing is controlled by step. pcutj and pcutk control truncation. Minimum and maximum number of steps are controlled by jmin, jmax, kmin and kmax. Accuracy can be increased by use of a finer grid - Increase sizes of arrays vw and qw, and jmin, jmax, kmin, kmax and 1/step proportionally.

Parameters:
q - Quantile for which to find p-value
v - Degrees of freedom for distribution
r - Number of samples for distribution
Returns:
P-value for q for given distribution

qtrng

public static double qtrng(double p,
                           double v,
                           double r)
Algorithm AS 190.1 Appl Statist (1983) Vol.32, No.2. Approximates the quantile p for a studentized range distribution having v degrees of freedom and r samples for probability p, p.ge.0.90 .and. p.le.0.99. Uses functions alnorm, ppnd, prtrng and qtrng0 - Algorithms AS 66, AS 111, AS 190 and AS 190.2

Parameters:
p - P-value for which to find quantile
v - Degrees of freedom for distribution
r - Number of samples for distribution
Returns:
Quantile at p for given distribution

qtrng0

public static double qtrng0(double p,
                            double v,
                            double r)
Algorithm AS 190.2 Appl Statist (1983) Vol.32, No.2. Calculates an initial quantile p for a studentized range distribution having v degrees of freedom and r samples for probability p, p.gt.0.80 .and. p.lt.0.995. Uses function ppnd - Algorithm AS 111

Parameters:
p - P-value for which to find initial quantile
v - Degrees of freedom for distribution
r - Number of samples for distribution
Returns:
Initial quantile at p for given distribution