# Mann-kendall test for trend

### Description

Calculates the Mann-Kendall statistic for monotonic trend and also the p-value against the null hypothesis of no trend.
Unlike the function `MannKendall`

, works for repeat values of time.

### Usage

1 | ```
mannkendall(time, Y, nsims.mk=999)
``` |

### Arguments

`time` |
Vector of values which define the direction of the trend. |

`Y` |
Vector of values for which you want to determine the trend. |

`nsims.mk` |
Number of replicate permuations to calculate the p-value. Default=999. |

### Details

Error checks of parameters not included so as not to slow down mannkendall. The statistic is calculated by considering
each case `j`

and considering the subset of observations that have time greater than `time[j]`

. The Mann Kendall
statistic is the number of observations in this subset for which `Y > Y[j]`

minus the number for
which `Y < Y[j]`

.
The statistic is summed over all `j`

. The p-value is calculated by `nreps`

random permutations of the Y values.

### Value

`mann` |
Mann-Kendall statistic of observed data, as calculated by |

`pvalue` |
P-value assuming a null hypothesis of no trend and two-way alternative hypothesis. |

### Author(s)

Jon Barry: Jon.Barry@cefas.co.uk

### References

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

Kendall, M.G. 1975. Rank Correlation Methods, 4th edition, Charles Griffin, London.

### See Also

`mannkendall.stat`

, `power.trend`

, `MannKendall`

### Examples

1 2 3 | ```
x = rep(1:10,rep(2,10))
y = rnorm(20, 5, 2)
mannkendall(x, y)
``` |