Performs the Mann–Kendall–Sneyers (MKS) test to detect a trend change in annual maximum series data. The test computes normalized progressive and regressive Mann–Kendall statistics and identifies statistically significant crossing points, indicating potential change points. Under the null hypothesis, there are no trend changes.
Arguments
- data
Numeric vector of observed annual maximum series values. Must be strictly positive, finite, and not missing.
- years
Numeric vector of observation years corresponding to
data
. Must be the same length asdata
and strictly increasing.- alpha
Numeric scalar in \([0.01, 0.1]\). The significance level for confidence intervals or hypothesis tests. Default is 0.05.
Value
A list containing the test results, including:
data
: Thedata
argument.years
: Theyears
argument.alpha
: The significance level as specified in thealpha
argument.null_hypothesis
: A string describing the null hypothesis.alternative_hypothesis
: A string describing the alternative hypothesis.progressive_series
: Normalized progressive Mann–Kendall-Sneyers statistics.regressive_series
: Normalized regressive Mann–Kendall-Sneyers statistics.bound
: Critical confidence bound for significance based onalpha
.change_points
: A dataframe of potential change points.p_value
: Two-sided p-value of the most significant crossing point.reject
: IfTRUE
, the null hypothesis was rejected at significancealpha
.
change_points
contains the years, test statistics, and p-values of each
potential change point. If no change points were identified, change_points
is empty.
Details
This function computes progressive and regressive Mann–Kendall-Sneyers statistics, normalized by their expected values and variances under the null hypothesis. The crossing points occur when the difference between the progressive and regressive statistics switches sign. The significance of detected crossing points is assessed using the quantiles of the normal distribution.
References
Sneyers, R. (1990). On the statistical analysis of series of observations. Technical note No. 143, World Meteorological Organization, Geneva.
Examples
data <- rnorm(n = 100, mean = 100, sd = 10)
years <- seq(from = 1901, to = 2000)
eda_mks_test(data, years)
#> $data
#> [1] 85.54915 85.71614 97.22417 101.68775 109.77722 102.96900 97.91774
#> [8] 96.94300 102.01555 89.55891 110.86274 85.63202 104.14338 97.27396
#> [15] 109.76791 93.27818 107.34289 103.56664 101.41236 103.49810 109.90516
#> [22] 95.04841 101.62542 115.25917 102.32179 94.17772 98.77404 105.29167
#> [29] 110.10684 109.21671 99.00200 94.00343 89.97952 96.54386 96.87132
#> [36] 118.40742 81.72863 100.76640 100.55287 103.52433 99.65863 104.98293
#> [43] 123.86866 86.82425 89.81833 78.07199 109.07017 105.91076 95.54329
#> [50] 109.39690 79.70020 95.64596 94.12719 107.52656 106.84281 90.71340
#> [57] 103.15814 101.68861 89.16990 94.98362 107.85188 104.65562 106.01239
#> [64] 98.39976 97.98901 103.80865 104.51256 96.98454 85.77457 88.90572
#> [71] 99.96630 121.10423 111.00964 87.02501 87.80226 95.98337 124.83532
#> [78] 100.11715 88.47333 112.44132 119.73193 89.69074 106.60512 106.76343
#> [85] 112.06801 90.97239 104.50397 107.26423 112.04740 113.73421 93.75126
#> [92] 100.81992 112.55942 88.79528 87.33852 100.56045 113.85555 98.87681
#> [99] 79.61201 93.19376
#>
#> $years
#> [1] 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915
#> [16] 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930
#> [31] 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945
#> [46] 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960
#> [61] 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975
#> [76] 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990
#> [91] 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000
#>
#> $alpha
#> [1] 0.05
#>
#> $null_hypothesis
#> [1] "There are no trend changes in the data."
#>
#> $alternative_hypothesis
#> [1] "There is at least one trend change in the data."
#>
#> $progressive_series
#> [1] 0.000000000 1.000000000 1.566698904 2.038098661 2.449489743
#> [6] 2.442274735 1.952442080 1.237179148 1.459600898 0.804984472
#> [11] 1.479147994 0.685725481 1.098159977 0.930663132 1.336153480
#> [16] 0.900450338 1.235778832 1.401474935 1.294466143 1.427548506
#> [21] 1.872209169 1.438094419 1.346933276 1.835525823 1.821687529
#> [26] 1.388617697 1.229967688 1.461982442 1.838290060 2.051718565
#> [31] 1.852609449 1.427047875 0.991642412 0.726397723 0.497050122
#> [36] 0.953462589 0.444681960 0.414872858 0.375003049 0.535947590
#> [41] 0.471741401 0.682755528 1.098869154 0.707998361 0.371728151
#> [46] -0.066277063 0.192579522 0.408849857 0.206876054 0.476796893
#> [51] 0.073099900 -0.094692916 -0.306828112 -0.067143616 0.137931262
#> [56] -0.113080559 -0.013767698 0.033539930 -0.255040001 -0.420943251
#> [61] -0.174241612 -0.018222245 0.172001599 0.104285199 0.033968311
#> [66] 0.160489018 0.297633748 0.179975652 -0.113949366 -0.380224370
#> [71] -0.382199501 -0.038889977 0.266690857 -0.004666736 -0.260734661
#> [76] -0.376728334 -0.035186455 -0.038830516 -0.283632770 0.008309325
#> [81] 0.309958897 0.092102475 0.255626328 0.417213418 0.675597641
#> [86] 0.481150167 0.575573165 0.735234995 0.978100431 1.230293801
#> [91] 1.038762175 1.018585955 1.261153001 1.009277697 0.749116113
#> [96] 0.728003649 0.978628544 0.917720657 0.613696486 0.440761285
#>
#> $regressive_series
#> [1] -0.44076128 -0.17231872 0.09514830 0.18076578 0.16459213 -0.03536600
#> [7] -0.08165677 -0.01327529 0.07420163 0.04456735 0.26139387 0.04252611
#> [13] 0.33157657 0.26029105 0.34687570 0.14422871 0.32449933 0.16124122
#> [19] 0.09210247 0.07341132 0.01661865 -0.19896627 -0.07334653 -0.10555937
#> [25] -0.40363750 -0.46200352 -0.33133827 -0.28574020 -0.40834476 -0.65023552
#> [31] -0.88719020 -0.88051783 -0.75166302 -0.56820988 -0.48146706 -0.39629696
#> [37] -0.72999640 -0.40924518 -0.43125981 -0.43560403 -0.49747839 -0.47738257
#> [43] -0.59701075 -0.99127424 -0.67848335 -0.47187011 -0.08206442 -0.32216952
#> [49] -0.45768243 -0.33301066 -0.59390490 -0.20687605 -0.07110432 0.10087499
#> [55] -0.12308597 -0.33259887 -0.10114262 -0.15698131 -0.20591040 0.06739163
#> [61] 0.25632276 0.03629062 -0.08800333 -0.23541986 -0.16345073 -0.07100716
#> [67] -0.13341999 -0.24791060 -0.16216453 0.32293192 0.66011815 0.78783860
#> [73] 0.31610431 0.10423455 0.63920497 1.16774842 1.43865537 0.92436597
#> [79] 1.09971926 1.69102764 1.42754851 0.87463929 1.40147494 1.40054934
#> [85] 1.35067551 1.03923048 1.58760181 1.58623108 1.50859606 1.32344821
#> [91] 0.80498447 1.04257207 0.74230749 0.15018785 0.56360186 1.46969385
#> [97] 1.35873244 0.52223297 -1.00000000 0.00000000
#>
#> $bound
#> [1] 1.959964
#>
#> $change_points
#> [1] index year value statistic p_value
#> <0 rows> (or 0-length row.names)
#>
#> $p_value
#> [1] 0.2397069
#>
#> $reject
#> [1] FALSE
#>