Regarding Modified Mann-Kendall test code from File Exchange

5 ビュー (過去 30 日間)
atharva aalok
atharva aalok 2022 年 10 月 18 日
回答済み: Shivansh 2023 年 9 月 6 日
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

回答 (1 件)

Shivansh
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.

カテゴリ

Help Center および File ExchangeHypothesis Tests についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by