Your data
Rows with a missing time or value are skipped and counted.
Result
The readings and Sen's line
readings Sen's line through the median point the interval's slopes
Every test on these data
The highlighted row is the one the summary uses. If the rows disagree, the verdict depends on how the correlation between readings is handled.
| Test | S | Variance × | Z | p-value | Verdict |
|---|
Season by season
| Season | Readings | Median | S | p-value | Sen's slope | Verdict |
|---|
Method and citation
The test. For n readings ordered by time, S = Σ_(i<j) sign(x_j − x_i): every later-higher pair adds one, every later-lower pair takes one away (Mann 1945). With no trend S has mean 0 and variance [n(n−1)(2n+5) − Σ t(t−1)(2t+5)]/18 over groups of t tied values (Kendall 1975, whose fuller formula is used when times are tied too), and Z = (S ∓ 1)/√Var S is close to normal. With 20 or fewer readings and no ties the p-value comes from the exact distribution of S instead. Kendall's tau is S / (n(n−1)/2).
The slope. Sen's (1968) slope is the median of (x_j − x_i)/(t_j − t_i) over all pairs, per year when the time column holds dates. Its interval takes the sorted slopes of rank (N ∓ z√Var S)/2, so it uses the same variance as the test. The line is drawn through the median time and median value (Conover 1980).
Serial correlation. Correlated readings make Var S larger than the formula says. The default, Yue & Wang (2004), multiplies it by 1 + 2 Σ_k (1 − k/n) r₁^k, where r₁ is the lag-1 autocorrelation after Sen's trend is removed. Hamed & Rao (1998) use the significant autocorrelations of the ranks of the detrended values instead, and trend-free pre-whitening (Yue et al. 2002) removes the lag-1 correlation from the data before testing. All of them are computed and shown so you can see whether the verdict depends on the choice.
Seasons. The seasonal Kendall test (Hirsch, Slack & Smith 1982) computes S and its variance within each month or quarter and adds them; its slope is the median of the within-season slopes. With 10 or more years and one value per season per year, Hirsch & Slack (1984) add the covariance between seasons, σ_gh = [K_gh + 4 Σ R_ig R_ih − n(n_g+1)(n_h+1)]/3, which is large when a wet year raises every month together. The homogeneity test of van Belle & Hughes (1984), χ² = Σ Z_g² − M·mean(Z)² on M−1 degrees of freedom, asks whether the seasons share one trend.
Verified by tests in the source: on the example's 96 annual peaks and 1,140 complete monthly flows, S, its variance, Z and p for the plain, Hamed-Rao and pre-whitened tests match pymannkendall 1.4.3 to 10⁻⁹, as do the seasonal test's statistic, variance and slope and the Hirsch-Slack covariance; Sen's interval matches scipy 1.17.1's theilslopes at 90% and 95%; exact p-values match scipy's exact Kendall tau; Kendall's tie-corrected variance equals the variance of S over all 5,040 orderings of a tied sample; the Hirsch-Slack variance with missing years equals the variance seen in 3,000 simulated series; and on 300 trend-free series with lag-1 correlation 0.6 the default correction finds a trend under 12% of the time where the plain test finds one over 20% of the time. The Yue-Wang test as pymannkendall runs it by default, summing every lag, is reproduced too but not offered: it called a trend in 45-51% of trend-free series, white noise included.
BibTeX
@article{mann1945nonparametric,
author = {Mann, Henry B.},
title = {Nonparametric tests against trend},
journal = {Econometrica},
volume = {13}, number = {3}, pages = {245--259}, year = {1945},
doi = {10.2307/1907187}
}
@book{kendall1975rank,
author = {Kendall, Maurice G.},
title = {Rank Correlation Methods},
edition = {4th}, publisher = {Charles Griffin}, address = {London}, year = {1975}
}
@article{sen1968estimates,
author = {Sen, Pranab Kumar},
title = {Estimates of the regression coefficient based on {K}endall's tau},
journal = {Journal of the American Statistical Association},
volume = {63}, number = {324}, pages = {1379--1389}, year = {1968},
doi = {10.1080/01621459.1968.10480934}
}
@article{hamed1998modified,
author = {Hamed, Khaled H. and Rao, A. Ramachandra},
title = {A modified {M}ann-{K}endall trend test for autocorrelated data},
journal = {Journal of Hydrology},
volume = {204}, number = {1--4}, pages = {182--196}, year = {1998},
doi = {10.1016/S0022-1694(97)00125-X}
}
@article{yue2004mann,
author = {Yue, Sheng and Wang, ChunYuan},
title = {The {M}ann-{K}endall test modified by effective sample size to detect trend in serially correlated hydrological series},
journal = {Water Resources Management},
volume = {18}, number = {3}, pages = {201--218}, year = {2004},
doi = {10.1023/B:WARM.0000043140.61082.60}
}
@article{yue2002influence,
author = {Yue, Sheng and Pilon, Paul and Phinney, Bob and Cavadias, George},
title = {The influence of autocorrelation on the ability to detect trend in hydrological series},
journal = {Hydrological Processes},
volume = {16}, number = {9}, pages = {1807--1829}, year = {2002},
doi = {10.1002/hyp.1095}
}
@article{hirsch1982techniques,
author = {Hirsch, Robert M. and Slack, James R. and Smith, Richard A.},
title = {Techniques of trend analysis for monthly water quality data},
journal = {Water Resources Research},
volume = {18}, number = {1}, pages = {107--121}, year = {1982},
doi = {10.1029/WR018i001p00107}
}
@article{hirsch1984nonparametric,
author = {Hirsch, Robert M. and Slack, James R.},
title = {A nonparametric trend test for seasonal data with serial dependence},
journal = {Water Resources Research},
volume = {20}, number = {6}, pages = {727--732}, year = {1984},
doi = {10.1029/WR020i006p00727}
}
@article{vanbelle1984nonparametric,
author = {van Belle, Gerald and Hughes, James P.},
title = {Nonparametric tests for trend in water quality},
journal = {Water Resources Research},
volume = {20}, number = {1}, pages = {127--136}, year = {1984},
doi = {10.1029/WR020i001p00127}
}
Limits
- A trend is not a cause. A significant test says the readings tend to rise or fall over the record. It does not say why: a change in the measuring method, the site, the lab, withdrawals upstream or the season you happened to sample can all make a real trend that is not the one you care about.
- Monotonic, not linear, and not a forecast. The test asks whether later readings tend to be higher (or lower). A series that rose and then fell can show no trend. Sen's slope is a typical rate over the record; it says nothing about next year.
- The corrections are estimates. In this tool's simulations (
eval/size-simulation.mjs), with 100 trend-free readings and lag-1 correlation 0.6, the tests called a trend at the 5% level this often: plain 30%, Yue-Wang 6%, Hamed-Rao 19% (first 3 lags 11%), trend-free pre-whitening 40%. At correlation 0.8 with 50 readings even Yue-Wang reached 13%. Long memory is worse still. Lags count rows, so very uneven spacing weakens them; the tool warns when it sees that. - Values below a detection limit (like
<0.5) are skipped, which biases the trend when many readings are censored. Methods for censored data (Helsel 2012) are not implemented here. - Size. Up to 20,000 readings and 8 million pairs for Sen's slope; aggregate daily data to monthly means first.
- Not modelled: covariates (the partial Mann-Kendall test), several sites at once (the regional Kendall test) and changepoints; see the changepoint detector for when a series shifted, and STL decomposition to separate trend from season in evenly spaced data.
Questions
What does the Mann-Kendall test tell me?
Whether a series tends to go up or down over time, without assuming the change is a straight line or the values are normally distributed. It compares every pair of readings: later-higher pairs count +1, later-lower pairs count -1. If there is no trend the total is close to zero, and the p-value says how unusual the observed total would be by chance.
What is Sen's slope?
The median of the slopes between every pair of readings, in your units per year (or per time unit). Because it is a median, a few outliers or a skewed distribution barely move it, unlike a least-squares line. The interval comes from the same variance as the test, so a 95% interval that excludes zero goes with a significant test.
Why correct for autocorrelation?
When each reading is like the one before it, as with river flow, groundwater levels or monthly temperatures, a run of high values happens by chance more often than the plain test assumes, so its p-values are too small. The corrections widen the variance of the statistic by an estimate of how much the correlation inflates it. In this tool's simulations of 1,000 trend-free series of 100 readings with lag-1 correlation 0.6, the plain test found a trend 30% of the time at the 5% level and the default Yue-Wang correction 6%.
When should I use the seasonal Kendall test?
When the data have a seasonal cycle, such as monthly flows, temperatures or concentrations. The seasonal test compares January with January, February with February and so on, and adds the results, so the cycle itself cannot pose as a trend. With at least 10 years the Hirsch-Slack covariance also accounts for a wet year making every month high together.
What does the homogeneity test mean?
It asks whether every season trends the same way. If spring rises while autumn falls, the seasonal test can add them up to no trend, or report one slope that fits no season. A small homogeneity p-value says look at the per-season table instead of the overall slope.
How many readings do I need?
At least 4, but power is low below about 10. With 20 or fewer readings and no ties the plain Mann-Kendall row uses the exact distribution of the statistic; the serial-correlation corrections use the normal approximation. With fewer than 10 years the seasonal covariance is not used.
Is my data uploaded anywhere?
No. The file is read and analysed by JavaScript in this browser tab. There are no accounts, cookies or analytics vendors.
Example data: the U.S. Geological Survey's monthly mean discharge, in cubic feet per second, and annual peak flows of the Potomac River near Washington, DC at Little Falls (gauge 01646500), retrieved from the National Water Information System on 2026-11-15. USGS data are in the public domain; recent months may be provisional. The gauge sits below the Washington Aqueduct's intakes, so the measured flow excludes what the city withdraws; USGS also publishes an adjusted record that adds the withdrawals back (01646502), which is in the source as a third data file.