Cumulative Mann-Kendall trend test

version (3.79 KB) by Steinar Thorvaldsen
Non-parametric cumulative Mann-Kendall trend test


Updated 23 Dec 2010

View License

A cumulative Mann-Kendall trend test.
Calculating p-values for monotonic trend of ordinal data sequences
(e.g. proteins) by a compound test based on Kendall's rank correlation.
Ref.: The DeltaProt toolbox at

Use: pval = cumKendallTest(Q,pop,tail)
returns p-values for testing the hypothesis of no correlation, against the alternative that there is a non-zero correlation between the columns in the (MxN)-matrix Q and the M-vector pop.
If pval is small, say less than 0.01,then the trend is considered significantly different from zero.
The test treats NaNs in Q or pop as missing values, and removes them.
The case N=1 is the classical Mann-Kendall test.

Q: MxN-matris with M independent observation series
pop: M-vector with population membership defined by an ordinalvariable e.g. optimal growth temperature for each of the M observation series.
tail: The alternative hypothesis against which to compute p-values.
Choices are:
TAIL: Alternative Hypothesis
'ne': trend is not zero (default)
'gt': trend is greater than zero
'lt': trend is less than zero

pval: P-value. Remark: - or + sign used here to indicate direction of trend
cumKendall computes p-values using large-sample approximations.
Unless data is very short (small sample size), this approximation is adequate.
When there are ties in the data, the null distribution of Kendall's test
may not be symmetric. Computing a two-tailed p-value in such cases is
not well-defined, and p-values for the two-tailed test is computed by
doubling the more significant of the two one-tailed p-values.

Please, use the following reference:
Thorvaldsen, S. , Flå, T. and Willassen, N.P. (2010) DeltaProt: a software toolbox for comparative genomics. BMC Bioinformatics 2010, Vol 11:573.

Cite As

Steinar Thorvaldsen (2022). Cumulative Mann-Kendall trend test (, MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R14SP3
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

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

Start Hunting!