Someone says air quality has improved. The annual mean fell from 68 to 61 µg/m³. Is that a trend, or is it two numbers from a noisy series that happen to differ?
The Mann-Kendall test exists to answer that question, and it is the standard tool in environmental statistics for a specific set of reasons.
Why Not Linear Regression?
Linear regression is the instinctive choice and it is usually the wrong one here. It assumes:
- Residuals are normally distributed
- Variance is constant across the range
- Observations are independent
- The relationship is linear
Air quality data violates all four. Concentrations are strongly right-skewed. Variance rises with the mean — dirty periods are also more variable. Consecutive observations are correlated, because a polluted week tends to follow a polluted day. And improvement is rarely a straight line.
Regression will still produce a slope and a p-value. Both will be more confident than the data justifies.
What Mann-Kendall Actually Does
It is a rank-based test. It compares every observation with every later observation and counts how many increased versus decreased.
The statistic S is the number of increasing pairs minus the number of decreasing pairs. Under the null hypothesis of no trend, increases and decreases should roughly balance and S should be near zero. A large positive S indicates an upward trend; a large negative S a downward one.
Because it uses only the order of values and not their magnitudes, it does not care about skewness or outliers. One extreme episode counts as one higher value, not as a lever pulling a regression line.
Three properties make it suited to this data:
| Property | Why it matters here |
|---|---|
| Non-parametric | No normality assumption; air data is skewed |
| Rank based | Robust to outliers and genuine episodes |
| Tolerates missing values | Monitoring records always have gaps |
Reading the Output
| Output | Meaning | Common misreading |
|---|---|---|
| S | Sum of increases minus decreases | Treating its size as a rate |
| tau | Correlation strength, −1 to +1 | Reading it as a percentage change |
| p-value | Evidence against "no trend" | Assuming it accounts for autocorrelation |
| n | Number of periods | Ignoring that small n means low power |
Critically, Mann-Kendall gives you direction and confidence — not magnitude. It tells you whether concentrations are falling, not by how much. For the rate you need a slope estimator, which is why the test is almost always paired with Theil-Sen.
A complete trend statement has three parts: direction, rate with a confidence interval, and significance. Reporting only the p-value is the most common failure in trend writing, and it is uninformative — a statistically significant decline of 0.2 µg/m³ per year is significant and irrelevant.
The Seasonality Problem
Air quality has a strong annual cycle. In most Indian cities winter concentrations are several times monsoon concentrations, driven by mixing height and inversions rather than by emissions.
Run a plain Mann-Kendall on monthly data and the seasonal cycle dominates. Worse, if your record starts in a winter month and ends in a monsoon month, the endpoints alone can create an apparent downward trend that is purely an artefact of where you cut the series.
Two fixes:
Seasonal Mann-Kendall. Runs the test within each month separately — all Januaries compared with each other, all Februaries with each other — then combines the results. Like is compared with like.
Deseasonalise first. Remove the seasonal component, then test the remainder. See seasonal decomposition of air quality data.
For monthly data the seasonal variant is the default choice. For annual means the plain test is appropriate, since the annual aggregation has already removed the cycle.
The Autocorrelation Problem
This is the issue most published trend analyses get wrong.
Mann-Kendall assumes observations are independent. Air quality data is serially correlated — today's concentration tells you something about tomorrow's, because the same weather pattern persists.
When positive autocorrelation is present, the test behaves as though it has more independent information than it really does. The p-value comes out too small, and trends are declared significant that are not.
The fix is pre-whitening — removing the serial correlation before testing. Several variants exist, and the trend-free pre-whitening approach is generally preferred because naive pre-whitening can remove part of the trend itself along with the correlation.
Practically: test for autocorrelation first. If the lag-1 autocorrelation is materially different from zero, use a pre-whitened variant and say so in the reporting. With annual data autocorrelation is usually weak; with monthly or daily data it is usually present.
A Defensible Workflow
- Start from a validated series with documented QA/QC — see cleaning air quality monitoring data
- Check data capture per period; exclude periods below the threshold rather than including partial data
- Aggregate to monthly or annual means, staged
- Plot the series before testing — a change point or a step is not a trend, and a test will not tell you the difference
- Handle seasonality, by the seasonal variant or by deseasonalising
- Test for autocorrelation; pre-whiten if present
- Run the test
- Estimate the slope with Theil-Sen and a confidence interval
- Consider confounders before attributing the change
- Report direction, rate, interval and significance together
Tools
R:
library(openair)
TheilSen(aq, pollutant = "pm25", deseason = TRUE)
library(trend)
mk.test(annual_series)
smk.test(monthly_ts) # seasonal variant
Python:
import pymannkendall as mk
mk.original_test(series) # plain
mk.seasonal_test(series, period=12) # seasonal
mk.hamed_rao_modification_test(series) # autocorrelation-adjusted
The pymannkendall package returns trend direction, p-value, tau and the Theil-Sen slope in one call, which makes the complete reporting statement straightforward.
Worked Example
A station has fourteen annual mean PM2.5 values. Working through the full procedure rather than jumping to the test:
Plot first. The series falls overall but with a visible flat stretch in the middle years. No obvious step, no instrument change in the metadata. A gradual trend is the right model.
Check capture. Twelve years above 80%, one at 76%, one at 68%. The 68% year is excluded rather than included at lower confidence, and that exclusion is recorded.
Autocorrelation. Lag-1 autocorrelation on annual means is 0.18 — weak, as is typical at annual resolution. Pre-whitening is unnecessary, but the check is documented.
Test. Mann-Kendall on thirteen annual values returns tau = −0.56, p = 0.008. Direction is downward and the evidence is strong.
Slope. Theil-Sen gives −2.1 µg/m³ per year, 95% CI −3.3 to −0.9. On a series mean of 58 µg/m³ that is about −3.6% per year.
Endpoint sensitivity. Dropping the first year moves the slope to −1.9; dropping the last moves it to −2.3. Both remain significant, so the conclusion does not rest on a single year.
Confounders. Regional wind speed over the same period shows no material trend, which weakens the "windier decade" explanation. No site move, no method change.
The reportable statement: concentrations declined by 2.1 µg/m³ per year (95% CI −3.3 to −0.9; approximately −3.6% per year), Mann-Kendall p = 0.008, based on thirteen annual means with capture above 76%.
Note how much of that work sits outside the test itself. The test is one line; the defensibility is everything around it.
What a Significant Result Does Not Mean
It does not mean emissions fell. Meteorology varies between years, and a windier run of years disperses more. Attributing a trend to policy without addressing this is the most common overclaim in air quality reporting. See meteorological normalisation.
It does not mean the trend will continue. The test describes the record, not the future.
It does not mean the change is important. Statistical significance and practical significance are different questions. With twenty years of data, a trivial decline can be highly significant.
It does not mean the site is compliant. A falling trend from a very high base may still breach the standard throughout.
Frequently Asked Questions
How many years of data do I need? For an annual-mean trend, at least eight to ten years for reasonable power against a moderate trend. See how many years of data you need.
Should I use monthly or annual values? Annual means are simpler and remove seasonality, but reduce the sample size. Monthly with the seasonal variant retains more information. Both are defensible if stated.
What if my p-value is 0.06? Report it as it is, with the slope and interval. The 0.05 threshold is a convention, not a physical boundary, and describing 0.06 as "no trend" overstates the evidence in the other direction.
Does Mann-Kendall handle missing data? Yes, better than most alternatives, which is a large part of why it is used here. Very sparse records still reduce power.
Can I use it on daily data? You can, but autocorrelation is strong at daily resolution and must be addressed. Aggregating to monthly is usually more informative.
How do I report the result? Direction, Theil-Sen slope in units per year, confidence interval, p-value, number of periods and data capture. All six.
What if there is a step rather than a gradual change? Mann-Kendall will register it as a trend. Plot first, and if a step is visible use a change point method instead — see change point detection.
Need to prove an air quality change is real? DSTechnoverse runs trend analysis, meteorological normalisation and compliance reporting on monitoring data — with the uncertainty stated, not hidden. We are based in Indore, Madhya Pradesh and work with clients across India. See our air quality analysis service, or talk to our team.