ConfidenceEllipseSimplex#

class mlquantify.confidence.ConfidenceEllipseSimplex(prev_estims, confidence_level=0.95)[source]#

Confidence ellipse for prevalence estimates in the simplex.

Defines a multivariate confidence region based on a chi-squared threshold:

\[\begin{split}CE_α(π) = \\begin{cases} 1 & \\text{if } (π - μ)^T Σ^{-1} (π - μ) \\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 prevalence estimate.

precision_matrixndarray of shape (n, n)

Inverse covariance matrix of estimates.

chi2_valfloat

Chi-squared cutoff threshold defining the ellipse.

References

[1] Moreo, A., & Salvati, N. (2025).

An Efficient Method for Deriving Confidence Intervals in Aggregative Quantification. Section 3.3, Equation (2).

Examples

>>> X = np.random.dirichlet(np.ones(3), size=200)
>>> ce = ConfidenceEllipseSimplex(X, confidence_level=0.95)
>>> ce.get_point_estimate().round(3)
array([0.33, 0.34, 0.33])
>>> ce.contains(np.array([0.4, 0.3, 0.3]))
True
contains(point)[source]#

Check whether a prevalence vector lies within the region.

get_point_estimate()[source]#

Return the point estimate of prevalence (e.g., mean of bootstrap samples).

get_region()[source]#

Return the parameters defining the confidence region.