Class Tukey
Computes the probability and quantile that the maximum of rr studentized ranges, each based on cc means and with df degrees of freedom for the standard error, is less than q.
The algorithm is based on that of the reference.
REFERENCE
Copenhaver, Margaret Diponzio & Holland, Burt S. Multiple comparisons of simple effects in the two-way analysis of variance with fixed effects. Journal of Statistical Computation and Simulation, Vol.30, pp.1-15, 1988.
RJ's Note: See Algorithm AS 190 by Lund and Lund
-
Field Summary
FieldsFields inherited from class jdistlib.generic.GenericDistribution
random -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondoublecumulative(double p, boolean lower_tail, boolean log_p) static final doublecumulative(double q, double rr, double cc, double df, boolean lower_tail, boolean log_p) function ptukey() [was qprob() ]:doubledensity(double x, boolean log) Density of Tukey HSD distribution using differentials of the cumulative --- WARNING: Untested!static final doubledensity(double x, double rr, double cc, double df, boolean log_p) static final doubledensity(double x, double rr, double cc, double df, boolean log_p, double diff) Density of Tukey HSD distribution using differentials of the cumulative --- WARNING: Untested!doublequantile(double q, boolean lower_tail, boolean log_p) static final doublequantile(double p, double rr, double cc, double df, boolean lower_tail, boolean log_p) Copenhaver, Margaret Diponzio & Holland, Burt S.doublerandom()static final doublerandom(double rr, double cc, double df, RandomEngine random) Tukey RNG by inversion -- WARNING: Untestedstatic final double[]random(int n, double rr, double cc, double df, RandomEngine random) Methods inherited from class jdistlib.generic.GenericDistribution
copyBackward, cumulative, cumulative, cumulative, cumulative_hazard, cumulative_hazard, cumulativeInto, density, density, densityInto, getRandomEngine, hazard, hazard, inverse_survival, inverse_survival, quantile, quantile, quantile, quantileInto, random, random, randomInto, setRandomEngine, survival, survival, survival
-
Field Details
-
rr
protected double rr -
cc
protected double cc -
df
protected double df
-
-
Constructor Details
-
Tukey
public Tukey(double rr, double cc, double df)
-
-
Method Details
-
cumulative
public static final double cumulative(double q, double rr, double cc, double df, boolean lower_tail, boolean log_p) function ptukey() [was qprob() ]:
q = value of studentized range
rr = no. of rows or groups
cc = no. of columns or treatments
df = degrees of freedom of error term
ir[0] = error flag = 1 if wprob probability > 1
ir[1] = error flag = 1 if qprob probability > 1qprob = returned probability integral over [0, q]
The program will not terminate if ir[0] or ir[1] are raised.
All references in wprob to Abramowitz and Stegun are from the following reference:
Abramowitz, Milton and Stegun, Irene A. Handbook of Mathematical Functions. New York: Dover publications, Inc. (1970).
All constants taken from this text are given to 25 significant digits.
nlegq = order of legendre quadrature
ihalfq = int ((nlegq + 1) / 2)
eps = max. allowable value of integral
eps1 & eps2 = values below which there is no contribution to integral.d.f. <= dhaf: integral is divided into ulen1 length intervals. else
d.f. <= dquar: integral is divided into ulen2 length intervals. else
d.f. <= deigh: integral is divided into ulen3 length intervals. else
d.f. <= dlarg: integral is divided into ulen4 length intervals.
d.f. > dlarg: the range is used to calculate integral.M_LN2 = log(2)
xlegq = legendre 16-point nodes
alegq = legendre 16-point coefficientsThe coefficients and nodes for the legendre quadrature used in qprob and wprob were calculated using the algorithms found in:
Stroud, A. H. and Secrest, D.
Gaussian Quadrature Formulas.
Englewood Cliffs,
New Jersey: Prentice-Hall, Inc, 1966.All values matched the tables (provided in same reference) to 30 significant digits.
f(x) = .5 + erf(x / sqrt(2)) / 2 for x > 0
f(x) = erfc( -x / sqrt(2)) / 2 for x < 0
where f(x) is standard normal c. d. f.
if degrees of freedom large, approximate integral with range distribution.
-
quantile
public static final double quantile(double p, double rr, double cc, double df, boolean lower_tail, boolean log_p) Copenhaver, Margaret Diponzio & Holland, Burt S. Multiple comparisons of simple effects in the two-way analysis of variance with fixed effects. Journal of Statistical Computation and Simulation, Vol.30, pp.1-15, 1988.
Uses the secant method to find critical values.
p = confidence level (1 - alpha)
rr = no. of rows or groups
cc = no. of columns or treatments
df = degrees of freedom of error termir(1) = error flag = 1 if wprob probability > 1
ir(2) = error flag = 1 if ptukey probability > 1
ir(3) = error flag = 1 if convergence not reached in 50 iterations = 2 if df < 2qtukey = returned critical value
If the difference between successive iterates is less than eps, the search is terminated
-
random
Tukey RNG by inversion -- WARNING: Untested- Parameters:
rr-cc-df-random-- Returns:
- random variate
-
random
-
density
public static final double density(double x, double rr, double cc, double df, boolean log_p) -
density
public static final double density(double x, double rr, double cc, double df, boolean log_p, double diff) Density of Tukey HSD distribution using differentials of the cumulative --- WARNING: Untested!- Parameters:
x-rr-cc-df-log_p-diff- tunable delta (set to 1e-10) in the preceding routine- Returns:
- Density value
-
density
public double density(double x, boolean log) Density of Tukey HSD distribution using differentials of the cumulative --- WARNING: Untested!- Specified by:
densityin classGenericDistribution
-
cumulative
public double cumulative(double p, boolean lower_tail, boolean log_p) - Specified by:
cumulativein classGenericDistribution
-
quantile
public double quantile(double q, boolean lower_tail, boolean log_p) - Specified by:
quantilein classGenericDistribution
-
random
public double random()- Specified by:
randomin classGenericDistribution
-