Skip to main content

hg_pmf

Function hg_pmf 

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

Computes probability mass function (pmf) 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_pmf;
println!("P(X=x): {}", hg_pmf(7, 20, 100, 50));