trend (version 1.1.1)

mk.test: Mann-Kendall Trend Test

Description

Performs the Mann-Kendall Trend Test

Usage

mk.test(x, alternative = c("two.sided", "greater", "less"),
  continuity = TRUE)

Arguments

x

a vector of class "numeric" or a time series object of class "ts"

alternative

the alternative hypothesis, defaults to two.sided

continuity

logical, indicates whether a continuity correction should be applied, defaults to TRUE.

Value

A list with class "htest"

data.name

character string that denotes the input data

p.value

the p-value

statistic

the z quantile of the standard normal distribution

null.value

the null hypothesis

estimates

the estimates S, varS and tau

alternative

the alternative hypothesis

method

character string that denotes the test

Details

The null hypothesis is that the data come from a population with independent realizations and are identically distributed. For the two sided test, the alternative hypothesis is that the data follow a monotonic trend. The Mann-Kendall test statistic is calculated according to:

$$ S = \sum_{k = 1}^{n-1} \sum_{j = k + 1}^n \mathrm{sgn}\left(x_j - x_k\right)$$

with \(\mathrm{sgn}\) the signum function (see sign).

The mean of \(S\) is \(\mu = 0\). The variance including the correction term for ties is

$$ \sigma^2 = \left\{n \left(n-1\right)\left(2n+5\right) - \sum_{j=1}^p t_j\left(t_j - 1\right)\left(2t_j+5\right) \right\} / 18$$

where \(p\) is the number of the tied groups in the data set and \(t_j\) is the number of data points in the \(j\)-th tied group. The statistic \(S\) is approximately normally distributed, with

$$z = S / \sigma$$

If continuity = TRUE then a continuity correction will be employed:

$$z = \mathrm{sgn}(S) ~ \left(|S| - 1\right) / \sigma$$

The statistic \(S\) is closely related to Kendall's \(\tau\): $$\tau = S / D$$

where

$$ D = \left[\frac{1}{2}n\left(n-1\right)- \frac{1}{2}\sum_{j=1}^p t_j\left(t_j - 1\right)\right]^{1/2} \left[\frac{1}{2}n\left(n-1\right) \right]^{1/2} $$

References

Hipel, K.W. and McLeod, A.I. (1994), Time Series Modelling of Water Resources and Environmental Systems. New York: Elsevier Science.

Libiseller, C. and Grimvall, A., (2002), Performance of partial Mann-Kendall tests for trend detection in the presence of covariates. Environmetrics 13, 71--84, http://dx.doi.org/10.1002/env.507.

See Also

cor.test, MannKendall, partial.mk.test, sens.slope

Examples

Run this code
# NOT RUN {
data(Nile)
mk.test(Nile, continuity = TRUE)

##
n <- length(Nile)
cor.test(x=(1:n),y=Nile, meth="kendall", continuity = TRUE)

# }

Run the code above in your browser using DataCamp Workspace