# Mann-Kendall trend test

Mann-Kendall trend test is used to perceive statistically significant decreasing or increasing trend in long term temporal data. It is based on two hypothesis; one is null hypothesis( H0 ) , which specify existence of no trend and other is Alternative hypothesis (H1) , which expresses significant increasing or decreasing trend in data over a time period.

Mann-Kendall trend test is non-parametric test that is this test is applicable to all types of distribution.

It can be applied on any data set containing a number of data points greater than four but sometimes with less number of samples the test has more chances of not finding a trend however having a trend if more number of data points were considered for the test. Yearly rainfall data of state Assam and Meghalaya , India. This test is widely used on real word data like hydrological data, climate data, environmental data .

The idea behind the test is that it looks for all possible differences between the relative magnitude of one sample to another successive sample and if differences keeps on increasing or keeps on decreasing then it signifies presence of a trend.

Mathematically this idea is expressed with Mann-Kendall statistic(S).

Initially it is assumed that there is no trend that is the value of S assumed to be equal to 0. If the value of data point at next time period is greater than the value of data points at earlier time period 1 is added to the value of S, Otherwise if it is lower than 1 is subtracted from the value of S.

Mann-Kendall statistic Khambhammettu, Prashanth (2020-11-20). ""Mann-Kendall Analysis for the Fort Ord Site", HydroGeoLogic, Inc.-OU-1 2004 Annual Groundwater Monitoring Report-Former Fort Ord, California, 2005" (PDF).{{cite web}}: CS1 maint: url-status (link)</ref> ==

Mann-Kendall statistic is denoted by ‘ S ‘ and it is defined as

$S = \sum_{i=1}^{n-1}\sum_{j=i+1}^{n}sig( xj - xi )$

Where, n is total number of data points in dataset and x1, x2, x3, x4, x5, …………. xn are values of data points .

$sig(xj-xi)=-1,if\ xj\ <\ xi$

$sig(xj-xi)=0,if\ xj\ =\ xi$

$sig(xj-xi)=1,if\ xj\ >\ xi$

For there to be an increasing trend , the value of Mann-Kendall statistic (S) should have very high positive value. And for there to be a decreasing trend value of S should have Very low negative value. To statistically express the importance of trend , it is necessary to calculate probability associated with Mann-Kendall statistics.

## Calculation of p-value associated with Mann-Kendall statistic(S)

Distribution of a dataset can be assumed to be a normal distribution if the number of data points in a data set is greater than 10 and the number of tied values inside the data set are less.

Variance of Mann-Kendall statistic is given as

$variance(s)=\frac{1}{18}\ast\left\{n\left(n-1\right)\left(2n+5\right)-\sum_{i=1}^{p}{t_i\left(t_i-1\right)\left(2t_i+5\right)}\right\}$

Where,

n is the total number of data points in a data set, p is the number of tied groups, a set of sample data having equal value is called tied group. And ti is the total number of data points in ith tied group.

Z- value associated with S

$Z=\left(S-1\right)/\sqrt{\left(VARIANCE\left(S\right)\right)}\ \ IF\ S>0$

$Z=0\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ IF\ S=0$

$Z=\frac{S+1}{\sqrt{VARIANCE\left(S\right)}}\ IF\ S<0$

probability(p value) can be calculated using the z-table.

On the basis of 5 % significance level , if p value is less than and equal to 0.05 , then the alternate hypothesis is accepted which signifies the presence of trend and if the p value greater than 0.05 , then null hypothesis is accepted which tells absence of trend in the data.

Limitations

1. This test is not suitable for data having seasonal effects. So to make the test more effective it is recommended to remove seasonal effects before applying the test.
2. Most of the time This test gives negative results for time series having fewer number of data points.