Admissibility Certificate
Structural facts about a sorted sample that determine which partitions can exist, computed once in O(n) and reused by every partition generator, refiner, and search over that sample.
The purpose is prevention rather than handling. Several conditions that would otherwise have to be detected and recovered from inside the fitting loop are properties of the data and the configuration alone, so they can be decided up front and the offending configurations simply refused. In particular, if the number of components is restricted to be no greater than maximumFeasibleGroups, then no partition search can be handed an infeasible problem.
Three structural constraints are represented:
A cut may not split a run of equal values. A partition is defined by value intervals, so tied observations must stay together. The permissible cut positions are the block boundaries, available as
admissibleCuts.Every group must contain at least
minimumGroupSizeobservations.Every group must contain at least
minimumDistinctValuesdistinct values. A group whose observations are all equal has zero sample variance and admits no finite normal or lognormal maximum likelihood estimate, so a value of 2 excludes that failure by construction rather than by catching it later.
Parameters
the observations in non-decreasing order, must not be empty. The array is not retained; only structural summaries are kept.
the least number of observations permitted in a group, must be positive
the least number of distinct values permitted in a group, must be positive
Constructors
Properties
The positions at which a cut may be placed without splitting a run of equal values, in increasing order. The first element is always 0 and the last is always the number of observations; these two are the outer boundaries rather than interior cuts.
The largest number of groups for which some partition of this sample satisfies all three structural constraints.
The number of distinct values in the whole sample.
The number of observations summarized by this certificate.
Functions
The number of distinct values within the index range from start until end. This is exact only when both endpoints are admissible cut positions, because otherwise a run of equal values straddles the boundary and is counted on one side only.
The number of distinct values among the first index observations.
Restricts a requested range of group counts to those that are structurally feasible for this sample. Searching only over the returned values guarantees that no partition search is ever handed an infeasible problem.
Explains why the supplied number of groups is not feasible, or null when it is feasible. Intended for diagnostics recorded alongside experimental results, so that a case excluded by structure is distinguishable from one that failed for a numerical reason.
Indicates whether a cut at the supplied position would split a run of equal values. Positions 0 and the number of observations are treated as admissible boundaries.
Indicates whether a partition of this sample into the supplied number of groups exists that satisfies all three structural constraints.
Indicates whether the index range from start until end satisfies the size and distinct-value requirements for a group.