Mann-Kendall Tau-b with Sen's Method (enhanced)

A non-parametric trend test including Sen's slope method using Mann-Kendall Tau technique
14.1K Downloads
Updated 27 Aug 2020

View License

The Mann-Kendall Tau non-parametric function computes a coefficient representing strength and direction of a trend for equally spaced data. While you do not need the Statistics Toolbox to compute Tau, you do need it to test for significance. This function will compute Tau-a and Tau-b, significance (and the various supporting statistics), and also a non-parametric slope method: Sens Method.

Note: Statistics Toolbox is only needed in this function to test for significance. Otherwise, there is nothing required beyond Matlab itself.

Enhancements include: now supports a seasonal kendall trend test recently submitted (sktt.m). Will allow for multiple observations in the same time index. Confidence intervals are added for Sens slope. Also a plot can be turned on/off.

Second enhancement: test for anomalies in trends, fixes, and notifies the user. Reference is in the comments of the function.

Given the speed of computers today, avoiding loops in Matlab is not as important for some computations as it has been in the past. Nevertheless, writing functions without loops is a form of elegance I think some people may appreciate. As such, this function is written without any loops. Example syntax to use the function is:
[taub tau h sig Z S sigma sen n senplot cilower ciupper] = ktaub(datain, alpha,wantplot)

Cite As

Jeff Burkey (2024). Mann-Kendall Tau-b with Sen's Method (enhanced) (https://www.mathworks.com/matlabcentral/fileexchange/11190-mann-kendall-tau-b-with-sen-s-method-enhanced), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2009b
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!
Version Published Release Notes
1.15.0.2

Updated comments. v 1.15.0.1 was an old version accidently uploaded. (oops).

1.15.0.1

Updated comments in file.

1.15.0.0

Added citation supporting method for computing confidence intervals for Sen's slope. Thanks goes to Dr. Jeff Thompson.

1.14.0.0

Enough inquiries about citation, I've added a suggested citation to the comments. Also included an HTML created from MATLAB Publish function.

1.13.0.0

Added a test for matlab version. When people get errors, it is generally because their version of matlab is too old and the syntax is not valid.

1.12.0.0

Updated calculation of confidence intervals on Sens slope.

1.10.0.0

Updated comments.

1.9.0.0

I've gotten a couple of inquiries asking for example dataset to use. I've included a MAT file that can be used with the m-file.

1.8.0.0

Now will test for anomalies in trend estimates. Fixes and notifies the user. See comments in function for more detail and the paper used for this enhancement.

1.6.0.0

I need to get used to uploading files. I uploaded the wrong version. Sorry. The version previously uploaded had a glitch in the Confidence interval calculations. Same glitch is in the seasonal kendall (sktt.m). Fixed now.

1.5.0.0

Sorry type-o in the description. This enhanced function WILL allow for multiple observations in the time index, ties, mission values, etc.

1.4.0.0

Try number 3. The webpage timed out on my try 2.

1.1.0.0

Updated the function to account for multiple observations per time index, also modifed outputs to support the newly added Seasonal Kendall trend test- sktt.m.

1.0.0.0

My last upload must have been too recent after the previous upload. As Nicholas mentioned s wasn't assigned for small N. Also the plotting routine didn't get uploaded with the last attempt. Here is another attempt.