Performs the Mann-Kendall Trend Test
mk.test(x, alternative = c("two.sided", "greater", "less"), continuity = TRUE)
A list with class "htest"
character string that denotes the input data
the p-value
the z quantile of the standard normal distribution
the null hypothesis
the estimates S, varS and tau
the alternative hypothesis
character string that denotes the test
a vector of class "numeric" or a time series object of class "ts"
the alternative hypothesis, defaults to two.sided
logical, indicates whether a continuity correction
should be applied, defaults to TRUE
.
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} $$
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, tools:::Rd_expr_doi("10.1002/env.507").
cor.test
,
MannKendall
,
partial.mk.test
,
sens.slope
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 DataLab