cox.stuart.test {randtests}R Documentation

Cox Stuart Trend Test

Description

Performs the Cox Stuart test of randomness.

Usage

cox.stuart.test(x, alternative)

Arguments

x

a numeric vector containing the data

alternative

a character string with the alternative hypothesis. Must be one of "two.sided" (default), "left.sided" or "right.sided". You can specify just the initial letter.

Details

Missing values are removed.

Data is grouped in pairs with the ith observation of the first half paired with the ith observation of the second half of the time-ordered data. If the length of vector X is odd the middle observation is eliminated. The cox stuart test is then simply a sign test applied to these paired data.

The possible values "two.sided", "left.sided" and "right.sided" define the alternative hypothesis. By using the alternative "two.sided" the null hypothesis of randomness is tested against either an upward trend or an downward trend. By using the alternative "left.sided" the null hypothesis of randomness is tested against an upward trend. By using the alternative "right.sided" the null hypothesis of randomness is tested against a downward trend.

Value

A list with class "htest" containing the components:

statistic

The number of pairs with a signal "+"

n

The number of pairs, after eliminanting ties.

p.value

the p-value for the test.

alternative

a character string describing the alternative hypothesis.

method

a character string indicating the test performed.

data.name

a character string giving the name of the data.

Author(s)

Ayana Mateus

References

Conover, W.J. (1999). Practical Nonparametric Statistics, 3rd edition, John Wiley & Sons (p. 166).

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

Sprent, P. and Smeeton, N.C. (2007). Applied Nonparametric Statistical Methods, 4th ed., Chapman and Hall/CRC Texts in Statistical Science (p. 108).

Examples

##
## Example 1
## Conover (1999)
## The total annual precipitation recorded each year, for 19 years.
##
precipitation <- c(45.25, 45.83, 41.77, 36.26, 45.37, 52.25, 35.37, 57.16, 35.37, 58.32, 
41.05, 33.72, 45.73, 37.90, 41.72, 36.07, 49.83, 36.24, 39.90)
cox.stuart.test(precipitation)

##
## Example 2
## Sweet potato production, harvested in the United States, between 1868 and 1937.
##
data(sweetpotato)
cox.stuart.test(sweetpotato$production)

[Package randtests version 1.0.2 Index]