ConfidenceEllipseCLR#
- class mlquantify.confidence.ConfidenceEllipseCLR(prev_estims, confidence_level=0.95)[source]#
Confidence ellipse for prevalence estimates in CLR-transformed space.
Applies the Centered Log-Ratio (CLR) transformation:
\[\begin{split}T(π) = [\log(π_1/g(π)), ..., \log(π_n/g(π))], \\ g(π) = (\prod_i π_i)^{1/n}\end{split}\]A confidence ellipse is then built in the transformed space:
\[\begin{split}CT_α(π) = \\begin{cases} 1 & \\text{if } (T(π) - μ_{CLR})^T Σ^{-1} (T(π) - μ_{CLR}) \\le χ^2_{n-1}(1-α) \\\\ 0 & \\text{otherwise} \\end{cases}\end{split}\]- Parameters:
- prev_estimsarray-like of shape (m, n)
Bootstrap prevalence estimates.
- confidence_levelfloat, default=0.95
Confidence level.
- Attributes:
- mean_ndarray of shape (n,)
Mean vector in CLR space.
- precision_matrixndarray of shape (n, n)
Inverse covariance matrix in CLR space.
- chi2_valfloat
Chi-squared threshold.
References
- [1] Moreo, A., & Salvati, N. (2025).
An Efficient Method for Deriving Confidence Intervals in Aggregative Quantification. Section 3.3, Equation (3).
Examples
>>> X = np.random.dirichlet(np.ones(3), size=200) >>> clr = ConfidenceEllipseCLR(X, confidence_level=0.9) >>> clr.get_point_estimate().round(3) array([ 0., 0., -0.]) >>> clr.contains(np.array([0.4, 0.4, 0.2])) True