1
$\begingroup$

I'm running the Mann-Kendall trend test on my data (35 different vectors, 5 elements each). What I'm doing for each one is:

install.packages("Kendall")
library("Kendall")
x=c(170.192, 179.397, 171.199, 108.399, 144.964)
MannKendall(x)

where x is a sample vector. I'm getting a result:

tau = -0.4, 2-sided pvalue =0.46243

Now, my question is – is it believable if I obtain exactly the same result for other vectors? For example:

y=c(2.63075, 2.01657, 1.39161, 2.51637, 1.79445)
MannKendall(y)
tau = -0.4, 2-sided pvalue =0.46243

z=c(7.12617, 6.01319, 4.64843, 6.42136, 5.36868)
MannKendall(z)
tau = -0.4, 2-sided pvalue =0.46243

Is it about the data type or I'm doing/interpreting something wrong? Or maybe it's ok and I shouldn't worry? Thanks.

$\endgroup$
  • $\begingroup$ Have you counted the numbers of increases in each of the vectors x, y, z? Since none of them contains any ties, the M-K test depends only on the vector lengths (which are all $5$) and the numbers of increases. $\endgroup$ – whuber Aug 8 '17 at 19:59
  • $\begingroup$ your code doesn't run; MannKendall is not a function in R. ... What did you leave out? $\endgroup$ – Glen_b Aug 9 '17 at 1:57
  • $\begingroup$ @Glen_b you need to install package Kendall to run this function $\endgroup$ – Sliwka Wegierka Aug 9 '17 at 11:09
  • 1
    $\begingroup$ You should edit your question to say so. If you include code, people should be able to copy it and run it and have it work (i.e. examples should be reproducible). $\endgroup$ – Glen_b Aug 9 '17 at 23:53
1
$\begingroup$

The test statistic will be obtained by calculating the Kendall correlation of the time series with the sequence $1,2,...,n$. Getting identical Kendall correlations with very small samples is not a surprise.

When there's no ties, this correlation corresponds to counting the number of increases (times $y_j>y_i$ when $j>i$) minus number of decreases (times $y_j<y_i$ when $j>i$) divided by number of such pairs.

Your 3 sets of ranks are

rank(x);rank(y);rank(z)
[1] 3 5 4 1 2
[1] 5 3 1 4 2
[1] 5 3 1 4 2

the last two sets are identical, so the Kendall correlation for z must be the same as for y. Let's just look at the first two, then. "3 5 4 1 2" has 3 increases (3 vs 5, 3 vs 4 and 1 vs 2) and the rest are decreases. "5 3 1 4 2" has 3 increases (3 vs 4, 1 vs 4 and 1 vs 2) with the rest decreases. This means the Kendall correlation with time in each case is $(3 - 7)/10 = -0.4$

... which is what your test says they are; the p-values are then the same because the sample sizes are the same.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.