Skip to main content

pass_hat_k

Function pass_hat_k 

Source
pub fn pass_hat_k(n: u32, c: u32, k: u32) -> f64
Expand description

Unbiased pass^k from n trials with c passes: C(c, k) / C(n, k), the probability that k trials drawn without replacement all passed; its expectation is p^k for a per-trial pass probability p.

k is clamped to 1..=n; with no trials the result is 0.

// 5 trials, 2 passed: C(2,2)/C(5,2) = 1/10
assert!((graphrt_eval::stats::pass_hat_k(5, 2, 2) - 0.1).abs() < 1e-12);