Skip to main content

hg_cdf

Function hg_cdf 

Source
pub fn hg_cdf(x: u64, n: u64, N: u64, M: u64) -> f64
Expand description

Computes cumulative distribution function (cdf) for X ~ HG(n,N,M) where X = the number of successes.

§Parameters

  • Sample size: n = 1,2,3,...,N
  • Population size: N = 1,2,3,...
  • Number of successes in population: M = 1,2,3,...,N

§Support

  • x = 0,1,2,...,n
  • x <= M
  • n-x <= N-M

§Example

Suppose X ~ HG(n=20,N=100,M=50). To compute P(X <= 7), use

use ruststat::hg_cdf;
println!("P(X<=x): {}", hg_cdf(7, 20, 100, 50));