[10] Simplex Uniformity#
pysht.simplex.uniformity tests whether compositional observations are uniform
with respect to volume on a probability simplex. The null is the Dirichlet
model with every concentration parameter equal to one.
The model selector controls the alternative:
|
Alternative model |
Wilks degrees of freedom |
|---|---|---|
|
one common positive concentration |
1 |
|
one positive concentration per component |
number of components |
Inputs must lie in the strict simplex interior. Boundary zeros are not
perturbed. The optimizer controls tolerance and max_iter are explicit and
fail loudly when a finite maximum cannot be established.
See the simplex-uniformity validation ledger for the likelihood, independent optimization oracle, null calibration, and MLE boundary cases.
Functions#
Goodness-of-fit tests for observations on a probability simplex.
- pysht.simplex.uniformity(x, *, model='symmetric', tolerance=1.0e-10, max_iter=200)[source]#
Test uniformity on a probability simplex with a Dirichlet LRT.
- Parameters:
- x
An
(n, k)matrix whose rows lie in the strict interior of the probability simplex. At least two rows and two components are needed. Rows whose sums differ from one by no more than a documented floating-point tolerance are normalized before fitting.- model
"symmetric"fits one common Dirichlet concentration parameter;"general"fits one positive parameter per component.- tolerance
Positive convergence tolerance for the score equations.
- max_iter
Positive maximum number of bracketing/root or Newton iterations.
- Returns:
- HypothesisTestResult
The likelihood-ratio statistic calibrated by Wilks’ chi-square approximation with one or
kdegrees of freedom.
- Parameters:
x (ArrayLike)
model (str)
tolerance (float)
max_iter (int)
- Return type:
Notes
The null is Dirichlet
alpha=(1, ..., 1), the uniform distribution with respect to simplex volume. Boundary components are rejected instead of being silently perturbed. The general-model fit rejects identical rows, for which its concentration MLE is unbounded. The symmetric fit is unbounded only when every row is the simplex barycenter.