Description Usage Arguments Details Value Author(s) References See Also Examples
Perform a one-sample quantile test and two-sample equality of quantiles.
1 2 3 |
x |
a numeric vector of data values. |
y |
a numeric vector of data or group values. |
q |
a quantile used to form the null hypothesis for one-sample test only. |
paired |
a logical indicating whether you want a paired test for two samples. |
p |
probability of the quantile, must be between 0 and 1. The default is 0.50 which is the median. |
alternative |
a character string specifying the alternative hypothesis, must be one of |
exact |
a logical indicating whether an exact p-value should be computed. See 'Details' for the meaning of |
correct |
a logical indicating whether to apply continuity correction in the normal approximation for the p-value. The default is |
Quantile test examines the location of one sample or the equality of locations for two samples. Compared to the t-test, quantile test does not require the normality assumptions of the data. So it is more general than the t-test, although it lacks statistical power when the normality assumptions do hold. For exact one-sample test, it is also called sign test. For this test, a new sequence is obtained by subtracting the location q from the original numeric sample and removing element(s) 0. The totals of positive or negative signs of the new sequence is defined as S+ or S-. Thus, S+ or S- has a binomial distribution with probability p. The paired-sample test has the similar procedures for the sequence of paired difference except setting q = 0. For exact two-sample quantile test, it is also called Brwon-Mood test which is based on hypergeometric distribution for the total numbers of the first sample greater than the pooled median. When the sample size is large, one can also use the normal approximation, i.e., argument exact = FALSE
, to the binomal distribution (one-sample case) and hypergeometric distribution (two-sample case) with or without continuity correction. See Conover, W. J. (1999) for more details. Missing values have been removed.
A list with class "htest" containing the following components:
data.name |
a character string giving the names of the data. |
method |
the type of test applied. |
statistic |
the value of the test statistic with a name describing it. |
p.value |
the p-value for the test. |
alternative |
a character string describing the alternative hypothesis. |
Debin Qiu <debinqiu@uga.edu>
Conover, W. J. (1999). Practical Nonparameteric Statistics (Third Edition ed.). Wiley. pp. 396-406.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | # one-sample test
x <- c(14.22, 15.83, 17.74, 19.88, 20.42, 21.96, 22.33, 22.79, 23.56, 24.45)
## normal approximation test
quant.test(x, q = 19)
## exact quantile test
quant.test(x, q = 19, exact = TRUE)
# two-sample test
y <- c(5.54, 5.52, 5.00, 4.89, 4.95, 4.85, 4.80, 4.78, 4.82, 4.85, 4.72, 4.48,
4.39, 4.36, 4.30, 4.26, 4.25, 4.22)
group <- as.numeric(gl(2,9))
## independent two-sample test
quant.test(y, group, exact = TRUE)
## paired two-sample test
quant.test(y,group, paired = TRUE)
|
Approximate one-sample quantile test
data: x
location = 21.19, p-value = 0.2059
alternative hypothesis: true location is not equal to 19
Exact one-sample quantile test
data: x
location = 21.19, p-value = 0.3438
alternative hypothesis: true location is not equal to 19
Exact two-sample (Brown-Mood) quantile test
data: y with group group
Difference = 0.53, p-value = 4.114e-05
alternative hypothesis: true location shift is not equal to 0
Approximately paired two-sample quantile test
data: y with group group
location = 0.55, p-value = 0.0027
alternative hypothesis: true location is not equal to 0
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.