Dear All,
The Mann-Kendall Test is used to determine whether a time series has a monotonic upward or downward trend. In MATLAB, Excel, and R there is a calculation command for this. I can't find any command in Mathematica for MK test. I tried to write a small code in Mathematica, but I got some errors. Any help would be appreciated.

data = {11.22, 12.29, 12.97, 14.15, 17.33, 17.60, 16.62, 14.43, 13.62,
11.01};
n = Length[data]
S = \!\(
\*UnderoverscriptBox[\(\[Sum]\), \(i = 1\), \(n - 1\)]\(
\*UnderoverscriptBox[\(\[Sum]\), \(k = i + 1\), \(n\)]Sign[
\*SubscriptBox[\(x\), \(k\)] -
\*SubscriptBox[\(x\), \(j\)]]\)\)
Zc = Piecewise[{{(S - 1)/Sqrt[(n (n - 1) (2 n + 5))/18], S > 0}, {0,
S = 0}, {(S + 1)/Sqrt[(n (n - 1) (2 n + 5))/18], S < 0}}]
\[Beta] = Median[(Subscript[x, i] - Subscript[x, j])/(i - j)]