Skip to main content

coverage

Function coverage 

Source
pub fn coverage(
    method: BinomialInterval,
    n: u64,
    p: f64,
    confidence: f64,
) -> f64
Expand description

The exact coverage probability $C(p, n) = P_{p}(L(X) \le p \le U(X))$ of an interval for $X \sim \mathrm{Bin}(n, p)$: the sum of the binomial probabilities of the counts whose interval contains $p$ (Brown et al. 2001, Sec. 2), no simulation.

ยงExamples

use comnum_sim::stats::{BinomialInterval, coverage};
// Table 1 of Brown et al. (2001): the Wald interval covers p = 1/2 with 0.891 at n = 10
let c = coverage(BinomialInterval::Wald, 10, 0.5, 0.95);
assert!((c - 0.891).abs() < 5e-4);