cs.test: Cox-Stuart Trend Test

Description Usage Arguments Details Value Author(s) References Examples

Description

Perform one-sample Cox-Stuart trend test.

Usage

1
2
cs.test(x, alternative = c("two.sided", "increasing", "decreasing"), 
        exact = TRUE, correct = TRUE)

Arguments

x

a numeric vector of data values.

alternative

indicates the alternative hypothesis and must be one of "two.sided" (default), "increasing", or "decreasing".

exact

TRUE (default) or FALSE indicating whether an exact p-value should be computed. See 'Details' for the meaning of TRUE.

correct

a logical indicating whether to apply continuity correction in the normal approximation for the p-value. The default is TRUE.

Details

Cox-Stuart trend analysis is a robust method to detect the presence of the trend regardless of the distribution of the data. Given the independent data, i.e., X[1],...,X[n], one can divide the data into two sequences with equal number of observations cutted in the midpoint and then take the paired difference, i.e., D = X[i] - X[i+c], i = 1, ..., floor(n/2), where c is the index of midpoint. The totals of the positive or negative sign in D is defined as S+ or S-. Under null hypothesis, S+ or S- has a binomial distribution with the number of experiment being the number of elements in D after removing element(s) 0 and probability p = 0.5. The exact method (exact = TRUE) is based on binomial distribution of statistic S+ ("increasing") or S- ("decreasing") or S = min(S+, S-) ("two.sided") and one can thus compute the exact p-value. When the sample size is large, one can also use the normal approximation (argument exact = TRUE) to the binomial distribution with or without continuity correction. Missing values have been removed.

Value

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.

alternative

a character string describing the alternative hypothesis.

p.value

the p-value for the test.

statistic

the value of the test statistic with a name describing it.

Author(s)

Debin Qiu <debinqiu@uga.edu>

References

D.R. Cox and A. Stuart (1955). Some quick sign tests for trend in location and dispersion. Biometrika, Vol. 42, pp. 80-95.

Examples

1
2
3
4
5
x <- 0.5*c(1:100) + rnorm(100,2,20)
# exact method
cs.test(x)
# approximate method
cs.test(x, exact = FALSE)

Example output

	Exact Cox-Stuart trend test

data:  x
S = 16, p-value = 0.01535
alternative hypothesis: data have a monotonic trend


	Approximate Cox-Stuart trend test

data:  x
S = 16, p-value = 0.01621
alternative hypothesis: data have a monotonic trend

snpar documentation built on May 1, 2019, 10:51 p.m.