quantileTestPValue {EnvStats}R Documentation

Compute p-Value for the Quantile Test

Description

Compute the p-value associated with a specified combination of m, n, r, and k for the quantile test (useful for determining r and k for a given significance level \alpha).

Usage

  quantileTestPValue(m, n, r, k, exact.p = TRUE)

Arguments

m

numeric vector of integers indicating the number of observations from the “treatment” group. Missing (NA), undefined (NaN), and infinite (Inf, -Inf) values are allowed but will be removed.

n

numeric vector of integers indicating the number of observations from the “reference” group. Missing (NA), undefined (NaN), and infinite (Inf, -Inf) values are allowed but will be removed.

r

numeric vector of integers indicating the ranks of the observations to use as the lower cut off for the quantile test. All values of r must be greater than or equal to 2 and less than or equal to the corresponding elements of m+n (the total number of observations from both groups). Missing (NA), undefined (NaN), and infinite (Inf, -Inf) values are allowed but will be removed.

k

numeric vector of integers indicating the number of observations from the “treatment” group contained in the r largest observations. This is the critical value used to decide whether to reject the null hypothesis. All values of k must be greater than or equal to 0 and less than or equal to the corresponding elements of r. Missing (NA), undefined (NaN), and infinite (Inf, -Inf) values are allowed but will be removed.

exact.p

logical scalar indicating whether to compute the p-value based on the exact distribution of the test statistic (exact.p=TRUE; the default) or based on the normal approximation (exact.p=FALSE).

Details

If the arguments m, n, r, and k are not all the same length, they are replicated to be the same length as the length of the longest argument.

For details on how the p-value is computed, see the help file for quantileTest.

The function quantileTestPValue is useful for determining what values to use for r and k, given the values of m, n, and a specified significance level \alpha. The function quantileTestPValue can be used to reproduce Tables A.6-A.9 in USEPA (1994, pp.A.22-A.25).

Value

numeric vector of p-values.

Note

See the help file for quantileTest.

Author(s)

Steven P. Millard (EnvStats@ProbStatInfo.com)

References

See the help file for quantileTest.

See Also

quantileTest, wilcox.test, htest.object, Hypothesis Tests.

Examples

  # Reproduce the first column of Table A.9 in USEPA (1994, p.A.25):
  #-----------------------------------------------------------------

  p.vals <- quantileTestPValue(m = 5, n = seq(15, 45, by = 5), 
    r = c(9, 3, 4, 4, 5, 5, 6), k = c(4, 2, 2, 2, 2, 2, 2)) 

  round(p.vals, 3) 
  #[1] 0.098 0.091 0.119 0.089 0.109 0.087 0.103 

  #==========

  # Clean up
  #---------

  rm(p.vals)

[Package EnvStats version 2.8.1 Index]