Skip to contents

Matteson and James (2014): empirical divergence \(\hat{E}\) of eq 5 (energy statistic on Euclidean distances raised to alpha), scaled statistic \(\hat{Q} = \frac{mn}{m+n}\hat{E}\) (eq 6), single-changepoint search over (tau, kappa) (eq 7), hierarchical application within existing clusters (Sec. 2.3, eq 8), and the within-cluster permutation stopping rule of Sec. 2.4 with p-value (number of permuted statistics at least the observed) / (R + 1), stopping when p exceeds sig. Permutations use the native Philox stream, bit-identical to the Python arm.

Usage

EDivisive(
  x,
  sig = 0.05,
  R = 199L,
  alpha = 1,
  min_size = 2L,
  max_cp = NULL,
  seed = 20260809
)

Arguments

x

Numeric vector or matrix with observations in rows.

sig

Stopping significance level p0.

R

Number of permutations.

alpha

Divergence index in (0, 2).

min_size

Minimum segment size (at least 2).

max_cp

Optional cap on the number of changepoints.

seed

Philox seed.

Value

List with changepoints (detection order), changepoints_sorted, p_values, q_stats, n_changepoints.

References

Matteson, D. S. and James, N. A. (2014), A nonparametric approach for multiple change point analysis of multivariate data, Journal of the American Statistical Association 109(505), 334-345 (arXiv:1306.4933), equations 4-8, Sections 2.1-2.4.

Examples

V <- c(1, 2, 3, 4, 5, 6, 7, 8)
EDivisive(V)
#> $changepoints
#> integer(0)
#> 
#> $changepoints_sorted
#> integer(0)
#> 
#> $p_values
#> [1] 0.055
#> 
#> $q_stats
#> [1] 9.333333
#> 
#> $n_changepoints
#> [1] 0
#> 
#> $estimate
#> integer(0)
#> 
#> $n
#> [1] 8
#> 
#> $method
#> [1] "E-divisive (Matteson-James 2014)"
#>