Struct probability::distribution::Binomial
source · [−]pub struct Binomial { /* private fields */ }
Expand description
A binomial distribution.
Implementations
sourceimpl Binomial
impl Binomial
sourcepub fn new(n: usize, p: f64) -> Self
pub fn new(n: usize, p: f64) -> Self
Create a binomial distribution with n
trails and success probability
p
.
It should hold that p >= 0
and p <= 1
.
sourcepub fn with_failure(n: usize, q: f64) -> Self
pub fn with_failure(n: usize, q: f64) -> Self
Create a binomial distribution with n
trails and failure probability
q
.
It should hold that if q >= 0
or q <= 1
. This constructor is
preferable when q
is very small.
Trait Implementations
sourceimpl Discrete for Binomial
impl Discrete for Binomial
sourcefn mass(&self, x: usize) -> f64
fn mass(&self, x: usize) -> f64
Compute the probability mass function.
For large n
, a saddle-point expansion is used for more accurate
computation.
References
- C. Loader, “Fast and Accurate Computation of Binomial Probabilities,” 2000.
sourceimpl Distribution for Binomial
impl Distribution for Binomial
sourceimpl Inverse for Binomial
impl Inverse for Binomial
sourcefn inverse(&self, p: f64) -> usize
fn inverse(&self, p: f64) -> usize
Compute the inverse of the cumulative distribution function.
The code is based on a C implementation by John Burkardt.
impl Copy for Binomial
Auto Trait Implementations
impl RefUnwindSafe for Binomial
impl Send for Binomial
impl Sync for Binomial
impl Unpin for Binomial
impl UnwindSafe for Binomial
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more