public class Tukey extends GenericDistribution
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
Constructor and Description |
---|
Tukey(double rr,
double cc,
double df) |
Modifier and Type | Method and Description |
---|---|
double |
cumulative(double p,
boolean lower_tail,
boolean log_p) |
static double |
cumulative(double q,
double rr,
double cc,
double df,
boolean lower_tail,
boolean log_p)
function ptukey() [was qprob() ]:
|
double |
density(double x,
boolean log)
Density of Tukey HSD distribution using differentials of the cumulative --- WARNING: Untested!
|
static double |
density(double x,
double rr,
double cc,
double df,
boolean log_p) |
static 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!
|
double |
quantile(double q,
boolean lower_tail,
boolean log_p) |
static double |
quantile(double p,
double rr,
double cc,
double df,
boolean lower_tail,
boolean log_p)
Copenhaver, Margaret Diponzio & Holland, Burt S.
|
double |
random() |
static double |
random(double rr,
double cc,
double df,
RandomEngine random)
Tukey RNG by inversion -- WARNING: Untested
|
static double[] |
random(int n,
double rr,
double cc,
double df,
RandomEngine random) |
cumulative_hazard, cumulative_hazard, cumulative, cumulative, cumulative, density, density, getRandomEngine, hazard, hazard, inverse_survival, inverse_survival, quantile, quantile, quantile, random, random, setRandomEngine, survival, survival, survival
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 > 1
qprob = 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 coefficients
The 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.
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 term
ir(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 < 2
qtukey = returned critical value
If the difference between successive iterates is less than eps, the search is terminated
public static final double random(double rr, double cc, double df, RandomEngine random)
rr
- cc
- df
- random
- public static final double[] random(int n, double rr, double cc, double df, RandomEngine random)
public static final double density(double x, double rr, double cc, double df, boolean log_p)
public static final double density(double x, double rr, double cc, double df, boolean log_p, double diff)
x
- rr
- cc
- df
- log_p
- diff
- tunable delta (set to 1e-10) in the preceding routinepublic double density(double x, boolean log)
density
in class GenericDistribution
public double cumulative(double p, boolean lower_tail, boolean log_p)
cumulative
in class GenericDistribution
public double quantile(double q, boolean lower_tail, boolean log_p)
quantile
in class GenericDistribution
public double random()
random
in class GenericDistribution