ds@mcpanalytics.aiEmail your data and your question and get an answer about your own data, with the method shown.Email your data and question. Get an answer.

Trend test

By MCP Analytics Team | Published , updated

Upload your data and get a trend test report. Free.

We email you the report link.

Free up to 10,000 rows. Encrypted in transit.

📊
-
Rows
-
Columns
-
Numeric

Running trend test analysis...

Running trend test analysis...

✓

Sent to . Inside: interactive charts, statistical results, R code, and AI insights.

Sample report

Open the full sample →

View all case studies → See all free tools →
Why an analysis, not a chat answer

Ask twice, get two answers? Watch how we fix that.

A simulated example, with the code and its output

The numbers below come from made-up data, made by the code on this page. They show the method. They are not output from this tool and not a finding about your data.

Question: Is a monthly series rising or falling, or just moving around, and how fast is it changing per month?

Inputs: Simulated data, not real figures. Seed 1 makes 36 monthly values. Built in by construction: a true rise of +0.5 per month from a start of 100, plus random noise with standard deviation 8. The power checks use seeds 2000 to 2299, 300 seeds each, with 12 or 36 months; in the 'no trend' runs the built-in slope is 0.

Method: The Mann-Kendall trend test with Sen's slope, the method the page names. For every pair of months, the test records whether the later value is higher or lower, adds up those signs, and turns the total into a z score and a p-value: the chance of a pattern this one-directional if there were no trend. Sen's slope is the median of the slope between every pair of months, so it is the size of the change per month, and a 95% range comes from the same variance used by the test. Power is the share of seeds with p below 0.05.

Result: In seed 1, the Mann-Kendall test gave z = 3.77 and p = 0.0002. Sen's slope was 0.462 per month, with a 95% range of 0.256 to 0.713, close to the built-in 0.5. Across 300 seeds with a built-in rise of 0.5 per month, the test gave p below 0.05 in 0.08 of seeds with 12 months and 0.95 with 36 months. With no trend built in it flagged 0.03 and 0.05 of seeds, near the 0.05 expected. So 12 months of this noisy series usually cannot show a real rise, while 36 months usually can.

Limit: The data is a straight line plus independent noise. It does not show seasonality, values that depend on the month before, gaps, or ties, which real series have and which change how the test should be read. It also does not show how the tool reports its results.

Python script (numpy and scipy only):

import numpy as np
from scipy.stats import norm

def slopes(y):
    n = len(y)
    return np.array([(y[j] - y[i]) / (j - i) for i in range(n - 1) for j in range(i + 1, n)])

def mk(y):
    n = len(y); s = 0.0
    for i in range(n - 1):
        s += np.sign(y[i + 1:] - y[i]).sum()
    var = n * (n - 1) * (2 * n + 5) / 18          # no ties in continuous data
    z = (s - np.sign(s)) / np.sqrt(var) if s else 0.0
    return z, 2 * norm.sf(abs(z)), var

def sen(y):
    sl = np.sort(slopes(y)); N = len(sl)
    z, p, var = mk(y)
    c = norm.ppf(0.975) * np.sqrt(var)
    lo = max(int(np.floor((N - c) / 2)), 0); hi = min(int(np.ceil((N + c) / 2)), N - 1)
    return np.median(sl), sl[lo], sl[hi]

def make(rng, n, b):
    return 100 + b * np.arange(n) + rng.normal(0, 8, n)

rng = np.random.default_rng(1)
y = make(rng, 36, 0.5)
z, p, _ = mk(y); m, lo, hi = sen(y)
print("Seed 1, 36 months, built-in slope +0.5 per month, noise sd 8")
print(f"Mann-Kendall z = {z:.2f}, p = {p:.4f}")
print(f"Sen slope per month: {m:.3f}, 95% range [{lo:.3f}, {hi:.3f}]")
for n in (12, 36):
    for lab, b in (("slope +0.5", 0.5), ("no trend", 0.0)):
        h = sum(mk(make(np.random.default_rng(2000 + s), n, b))[1] < 0.05 for s in range(300))
        print(f"{n} months, {lab}: p < 0.05 in {h/300:.2f} of 300 seeds")

Printed output from running the code above:

Seed 1, 36 months, built-in slope +0.5 per month, noise sd 8
Mann-Kendall z = 3.77, p = 0.0002
Sen slope per month: 0.462, 95% range [0.256, 0.713]
12 months, slope +0.5: p < 0.05 in 0.08 of 300 seeds
12 months, no trend: p < 0.05 in 0.03 of 300 seeds
36 months, slope +0.5: p < 0.05 in 0.95 of 300 seeds
36 months, no trend: p < 0.05 in 0.05 of 300 seeds

What's in the report?

Is this series rising or falling rather than just moving around? Mann-Kendall with Sen's slope, the size per period and its range.

📊

Statistical Results

Analysis with charts and tables.

🤖

AI Insights

Plain-English reading of the results.

Questions?

See our FAQ for pricing, privacy and how the analysis works.

How to cite this tool

By MCP Analytics Team. Last updated 5 November 2026. Cite as: MCP Analytics Team (2026). Trend test. Free tool. https://mcpanalytics.ai/free/standard_trend_test_v2. Accessed the date you used it.

Your data has more stories to tell

Run it on your data

Sign up to save datasets and schedule runs

Powered by MCP Analytics