Learn R Programming

MultivariateTrendAnalysis (version 0.1.3)

mkUnivariate: Univariate Mann-Kendall Test

Description

The functions performs the univariate Mann-Kendall test.

Usage

mkUnivariate(x)

Value

A named list

  • statistic, the estimated Mann-Kendall test statistics.

  • p.value, the estimated p-value for the test.

Arguments

x

Numeric vector representing a data series.

Details

The univariate Mann-Kendall (MK) test is used to detect monotonic trends in a univariate data series. It tests the null hypothesis (\(h_0\)) of no trend, against an alternative.

Let \((x_1, x_2, ..., x_n)\) be a data series of length \(n\), the MK test statistic is given by: $$M = \sum_{i=1}^{n-1} \sum_{j=i+1}^{n} sgn(x_j-x_i)$$ where \(sgn(\cdot)\) is the sign function: $$ sgn(x)=\begin{cases} -1 \quad \text{if } x<0, \\ 0 \quad \text{if } x=0, \\ +1 \quad \text{if } x>0 \end{cases} $$ Under \(H_0\) the test statistic is asymptotically normally distributed with mean and variance: $$E(M) = 0$$ $$\text{Var}(M)=\frac{n(n-1)(n+5)}{18}$$

References

  • Hamed, K.H., Rao, A.R., 1998. A modified Mann-Kendall trend test for autocorrelated data. J. Hydrol. 204 (1–4), 182–196.

  • Kendall, M., (1975). Rank Correlation Methods; Griffin: London.

See Also

mkComponent: The multivariate extension of this test.

Examples

Run this code
# Sample data (Both marginal distributions have trend):
dataMarginalTrend <- generate_data("marginalTrend", n = 50)

# Perform two tailed MK test on sample data:
mkUnivariate(dataMarginalTrend[, 1])
mkUnivariate(dataMarginalTrend[, 2])

Run the code above in your browser using DataLab