Regarding Modified Mann-Kendall test code from File Exchange
5 views (last 30 days)
Show older comments
I am trying to understand the following code from File Exchange: Mann-Kendall Modified test
The author is no longer active it seems. Therefore, I am asking my doubt here.
On line 86: We have
if S >= 0
Z=((S-1)/StdS)*(S~=0);
else
Z=(S+1)/StdS;
end
Why is there a -1 and a +1 here when finding the Z-score here?
Thanks
0 Comments
Answers (1)
Shivansh
on 6 Sep 2023
Hi Atharva,
In the Mann-Kendall test, the step
if S >= 0
Z=((S-1)/StdS)*(S~=0);
checks if Kendall's rank correlation coefficient (S) is greater than zero. If S is positive, it indicates a positive trend in the data, meaning that there is a systematic increase in the values over time. In this case, we calculate the Z-score by subtracting 1 from S and dividing it by the square root of the variance of S. If S=0, Z is automatically assigned a value of 0.
Similarly, the step
else
Z=(S+1)/StdS;
checks if S is less than zero. If S is negative, it indicates a negative trend in the data, meaning that there is a systematic decrease in the values over time. In this case, we calculate the Z-score by adding 1 to S and dividing it by the square root of variance of S.
These adjustments ensure that the tie correction is properly applied to the test statistic S when calculating the Z-score. By subtracting -1 or adding +1, the code accounts for ties in the data and helps in obtaining accurate results.
0 Comments
See Also
Categories
Find more on Hypothesis Tests in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!