DCI uses adaptive contrasts and local IQR exceedances to flag possible changes. It then calculates an I1 statistic and refined location between neighboring flags. This release provides descriptive candidates, not significance-tested changes. Every pvalue is NA, including for windows of length 100: a window selected by DCI is not a prespecified standalone test.
set.seed(21)
y <- rnorm(160) + rep(c(0,4,-3,1), c(50,15,15,80))
candidates <- dcii1(y)
candidates
#> Flag Direction pvalue istatistic etavec Magnitude
#> 1 20 -ve NA 6.7950 12 0.1790995
#> 2 36 +ve NA 10.8172 37 0.4733711
#> 3 48 +ve NA 24.9503 50 2.7612641
#> 4 64 -ve NA 43.9805 65 -4.5028308
#> 5 81 +ve NA 36.3140 84 2.1208446
#> 6 98 -ve NA 3.1445 105 0.4516672
#> 7 121 +ve NA 10.4935 125 0.6135779
#> 8 136 -ve NA 4.1511 136 -0.8661802
#> 9 157 -ve NA 5.3894 147 0.3266164
locations <- change_points(candidates)
locations
#> [1] 12 37 50 65 84 105 125 136 147
plot(y, type="l", xlab="Observation", ylab="Value")
abline(v=locations, col="firebrick", lty=2)Flag is the preliminary location; etavec is refined within its neighboring window. Locations are the last observation before a boundary. Direction is the original flag sign and can differ from the sign of Magnitude. Each window has its own scale, so Magnitude is not an original-unit shift estimate.
dcii1(y, nbrhudfracleni1=.5)
#> Flag Direction pvalue istatistic etavec Magnitude
#> 1 21 -ve NA 7.3758 20 -0.5414625
#> 2 32 +ve NA 10.0363 34 0.8766554
#> 3 49 +ve NA 25.1361 49 2.2845397
#> 4 64 -ve NA 45.5945 65 -4.5524460
#> 5 81 +ve NA 36.8535 83 2.3718042
#> 6 96 -ve NA 2.9081 101 -0.1049113
#> 7 112 -ve NA 4.5059 112 -0.4059823
#> 8 127 +ve NA 9.1439 123 0.6784752
#> 9 148 +ve NA 3.6259 141 -0.3311283
dcii1(y, flag_method="runs")
#> Flag Direction pvalue istatistic etavec Magnitude
#> 1 20 -ve NA 6.7950 12 0.1790995
#> 2 36 +ve NA 10.8172 37 0.4733711
#> 3 48 +ve NA 24.9503 50 2.7612641
#> 4 64 -ve NA 43.8735 65 -4.6280718
#> 5 82 +ve NA 36.3140 84 2.1208446
#> 6 98 -ve NA 2.9235 105 0.4199170
#> 7 121 +ve NA 10.4935 125 0.6135779
#> 8 136 -ve NA 4.1511 136 -0.8661802
#> 9 157 -ve NA 5.3894 147 0.3266164The localization fraction controls how many contrasts each IQR window contains. Zero local IQR is an intentional error. The default legacy flag rule preserves the original centroid and run-selection conventions, with negative-terminal indexing repaired. The runs option includes all maximal nonzero same-sign runs. It can produce different candidates. r1 thresholds absolute flag weights, while il_cutoff thresholds individual local exceedances; neither is a significance level.
truth <- c(50,65,80)
covering_metric(length(y), truth, locations)
#> [1] 0.4552632
covering_metric_unwtd(length(y), truth, locations)
#> [1] 0.6379934Covering uses the best Jaccard overlap for each true segment. The weighted metric weights by true-segment length; the unweighted metric gives each true segment equal weight. Values lie in [0,1], with 1 for identical partitions. Neither metric is a test or p-value. Candidates can occur in noise-only data.
The earlier development interface’s accepted-output and sequential testing options are not part of this release. change_points() only sorts and deduplicates the candidate locations, without accepting or rejecting hypotheses.
Waychal, N., Laha, A. K. and Sinha, A. (2026). Closely spaced change-point detection with an application to geopolitical shocks in oil and gas markets. https://doi.org/10.48550/arXiv.2610.23476.