nb_cdf

Function nb_cdf 

Source
pub fn nb_cdf(x: i32, r: i32, p: f64) -> f64
Expand description

Computes cumulative distribution function (cdf) for X ~ NB(r,p) where X = the number of failures prior to the rth success.

§Parameters

  • r = 1,2,...
  • p = probability of success (0 <= p <= 1)

§Support

  • x = 0,1,2,...

§Example

Suppose X ~ NB(r=2, p=0.6). To compute P(X <= 3), use

use ruststat::nb_cdf;
println!("P(X<=x): {}", nb_cdf(3, 2, 0.6));