Homogeneity Tests¶
rucola.SNHTTest(alpha=0.05, min_years_from_end=5, min_relative_signal=1.0)
¶
Bases: HomogenizationTest
Standard Normal Homogeneity Test (Alexandersson 1986).
Scans every candidate split m and maximises a likelihood-ratio statistic over the standardised series \(z_i = (q_i - \bar{q}) / \hat{\sigma}\):
where \(\bar{z}_1 = \tfrac{1}{m}\sum_{i=1}^{m} z_i\) and \(\bar{z}_2 = \tfrac{1}{n-m}\sum_{i=m+1}^{n} z_i\) are the segment means. Uses tabulated critical values from Alexandersson & Moberg (1997) at alpha ∈ {0.01, 0.05, 0.10}.
Initialise; raise immediately if alpha is not in the critical-value table.
Source code in src/rucola/_homogeneity.py
name
property
¶
Return test name.
detect(q_series, years)
¶
Apply SNHT to q_series and return a TestResult.
Source code in src/rucola/_homogeneity.py
rucola.BuishandTest(alpha=0.05, min_years_from_end=5, min_relative_signal=1.0)
¶
Bases: HomogenizationTest
Buishand range test (Buishand 1982).
Built on cumulative deviations \(S_k = \sum_{i=1}^{k}(q_i - \bar{q})\). Under the null these form a bridge anchored at \(S_0 = S_n = 0\); a break pulls the bridge away from zero, inflating its range:
The break is located at \(k^\star = \arg\max_k |S_k|\). Uses tabulated critical values at alpha ∈ {0.01, 0.05, 0.10}.
Initialise; raise immediately if alpha is not in the critical-value table.
Source code in src/rucola/_homogeneity.py
name
property
¶
Return test name.
detect(q_series, years)
¶
Apply Buishand range test to q_series and return a TestResult.
Source code in src/rucola/_homogeneity.py
rucola.PettittTest(alpha=0.05, min_years_from_end=5, min_relative_signal=1.0)
¶
Bases: HomogenizationTest
Pettitt test (Pettitt 1979).
Non-parametric rank test based on the Mann–Whitney statistic. For each candidate split t it counts whether values after the split tend to be larger or smaller than values before:
Because it uses signs rather than magnitudes, the test is robust to outliers and to non-normal distributions. The p-value is approximated analytically as \(p \approx 2 \exp\!\bigl(-6K^2 / (n^3 + n^2)\bigr)\), so any \(\alpha > 0\) is supported.
Source code in src/rucola/_homogeneity.py
name
property
¶
Return test name.
detect(q_series, years)
¶
Apply Pettitt test to q_series and return a TestResult.
Source code in src/rucola/_homogeneity.py
rucola.WorsleyTest(alpha=0.05, min_years_from_end=5, min_relative_signal=1.0)
¶
Bases: HomogenizationTest
Worsley likelihood ratio test (Worsley 1979).
Maximum standardised two-sample t-statistic over all candidate change points \(k\):
where \(s_p\) is the pooled standard deviation of the two segments. Critical values are computed analytically via the Bonferroni approximation \(c = \Phi^{-1}\!\bigl(1 - \alpha / (2(n-1))\bigr)\) and support any \(\alpha > 0\).
Source code in src/rucola/_homogeneity.py
name
property
¶
Return test name.
detect(q_series, years)
¶
Apply Worsley test to q_series and return a TestResult.
Source code in src/rucola/_homogeneity.py
rucola.EasterlingPetersonTest(alpha=0.05, min_years_from_end=5, min_relative_signal=1.0)
¶
Bases: HomogenizationTest
Easterling–Peterson two-phase regression test (Easterling & Peterson 1995).
For each candidate break \(k\), fits a linear trend plus a step:
The step change \(c\) is tested via its OLS t-statistic \(t_k(c)\), and the test statistic is the maximum absolute value over all candidate breaks:
Unlike mean-shift tests, the linear trend term \(b\) prevents a real trend
from being mistaken for a break — useful for temperature series.
Critical values use the same Bonferroni normal approximation as
WorsleyTest.
Source code in src/rucola/_homogeneity.py
name
property
¶
Return test name.
detect(q_series, years)
¶
Apply Easterling–Peterson test to q_series and return a TestResult.
Source code in src/rucola/_homogeneity.py
664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 | |
rucola.StarsTest(l=10, alpha=0.05, min_years_from_end=5, min_relative_signal=1.0)
¶
Bases: HomogenizationTest
STARS: Sequential T-test Analysis of Regime Shifts (Rodionov 2004).
Scans the Q-series sequentially and declares a regime shift at year j when the Regime Shift Index (RSI) stays consistently positive (or negative) over the following l years. Unlike the other tests that maximise a global statistic, STARS propagates a running regime mean, so it is sensitive to shifts that accumulate gradually across the series rather than appearing as a single dominant peak.
Variance is estimated from the mean-square successive differences (MSSD), which is robust to the very breaks being detected:
The minimum detectable mean shift is \(\delta = t_{\text{crit}} \cdot \hat{\sigma} \sqrt{2/l}\), where \(t_{\text{crit}}\) is the two-tailed t-distribution critical value for \(\nu = 2(l-1)\) degrees of freedom.
A shift at year j is confirmed when the RSI
does not change sign for all \(k \in [j,\, j+l-1]\). If multiple shifts are confirmed, the one with the largest t-statistic is returned as the primary break year.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
l
|
int
|
Cut-off length in years — the minimum regime duration and the RSI confirmation window. Sets \(\nu = 2(l-1)\) degrees of freedom for the t-test. Typical values for annual climate data: 10–15. |
10
|
alpha
|
float
|
Significance level for the t-test. Supported: |
0.05
|
min_years_from_end
|
int
|
Inherited edge-effect guard (default: 5). |
5
|
min_relative_signal
|
float
|
Minimum ratio of the confirmed t-statistic to the critical value (default: 1.0). |
1.0
|
References
Rodionov, S. N. (2004): A sequential algorithm for testing climate regime shifts. Geophys. Res. Lett., 31, L09204. https://doi.org/10.1029/2004GL019448
Initialise with cut-off length, significance level, and edge-guard settings.
Source code in src/rucola/_homogeneity.py
name
property
¶
Return test name.
__repr__()
¶
Return short summary string.
Source code in src/rucola/_homogeneity.py
detect(q_series, years)
¶
Apply STARS to q_series and return a TestResult.
Source code in src/rucola/_homogeneity.py
833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 | |