Skip to contents

Repeatedly splits the series at the point maximising the energy statistic of Matteson and James (2014), eqs. (5)-(7), stopping when a within-segment permutation test no longer rejects at level sig. Detects changes in the full distribution rather than only the mean, and needs no parametric model.

Usage

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

Arguments

x

Numeric vector, or a matrix with one observation per row.

sig

Significance level of the permutation stopping rule.

R

Number of permutations per test.

alpha

Energy exponent, in (0, 2).

min_size

Minimum segment length.

max_cp

Optional cap on the number of change points.

seed

Seed of the counter-based stream shared with the Python arm, so the permutation test is reproducible across languages.

Value

A list with changepoints (in discovery order), changepoints_sorted, p_values, q_stats, n_changepoints, estimate, n, method.

References

Matteson, D. S. and James, N. A. (2014). A nonparametric approach for multiple change point analysis of multivariate data. JASA, 109(505), 334-345.

Examples

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