Regarding Modified Mann-Kendall test code from File Exchange
5 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(1 个)
Shivansh
2023-9-6
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 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Hypothesis Tests 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!