Regarding Modified Mann-Kendall test code from File Exchange

5 visualizaciones (últimos 30 días)
atharva aalok
atharva aalok el 18 de Oct. de 2022
Respondida: Shivansh el 6 de Sept. de 2023
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

Respuestas (1)

Shivansh
Shivansh el 6 de Sept. de 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.

Categorías

Más información sobre Hypothesis Tests en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by