elbow_helper.multi_fwer module
Phase M3: the Bonferroni-gated sequential test for elbow_helper.robust_knees().
Ported from the validated research/multiknee/fwer.py; see ELBOW-en.tex
section 20 for the derivation. Independent of multi_criteria: walks
the nested DP segmentation sequence and, at each step, tests whether adding
one more breakpoint reduces error by more than an IID-residual permutation
null would produce, at a Bonferroni-corrected significance level.
- elbow_helper.multi_fwer.sequential_fwer_gate(x, y, segmentations, alpha, n_permutations, min_seg, seed)[source]
Bonferroni-gated sequential test over a nested segmentation sequence.
- Parameters:
x (numpy.ndarray) – The curve.
y (numpy.ndarray) – The curve.
segmentations (sequence of Segmentation) – One
Segmentationperk = 0, 1, ..., k_max, as returned bydp_optimal_partition().alpha (float) – Nominal family-wise significance level.
n_permutations (int) – Number of IID-residual permutation replicates per tested step.
min_seg (int) – Minimum number of points per segment.
seed (int) – Seed for the permutation random number generator.
- Returns:
The accepted k (the largest k whose sequential test, together with every test before it, passed the Bonferroni-corrected threshold) and the p-value computed at each tested step (stopping at the first failure).
- Return type: