Learn R Programming

randtests (version 1.0.1)

rank.test: Mann-Kendall Rank Test

Description

Performs the Mann-Kendall rank test of randomness.

Usage

rank.test(x, alternative)

Arguments

x

a numeric vector containing the observations

alternative

a character string specifying the alternative hypothesis. Must be one of "two.sided" (default), "left.sided" or "right.sided".

Value

A list with class "htest" containing the components:

statistic

the value of the normalized statistic test.

parameter

The size n of the data.

p.value

the p-value of the test.

method

a character string indicating the test performed.

data.name

a character string giving the name of the data.

P

the value of the (non normalized) P statistic.

mu

the mean value of the P statistic.

var

the variance of the P statistic.

Details

Missing values are removed.

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

References

Brockwell, P.J. and Davis, R.A. (2002). Introduction to Time Series and Forecasting, 2nd edition, Springer (p. 37).

Mann, H.B. (1945). Nonparametric test against trend. Econometrica, 13, 245--259.

Kendall, M. (1990). Rank correlation methods, 5th edition. Oxford University Press, USA.

Examples

Run this code
# NOT RUN {
##
## Example 1
## Sweet potato yield per acre, 1868-1937 in the United States.
## Available in this package.
##
data(sweetpotato)
rank.test(sweetpotato$yield)

##
## Example 2
## Old Faithful Geyser Data on Eruption time in mins.
## Available in R package datasets.
##
rank.test(faithful$eruptions)
# }

Run the code above in your browser using DataLab