Struct probability::distribution::Binomial [−][src]
pub struct Binomial { /* fields omitted */ }
A binomial distribution.
Methods
impl Binomial
[src]
impl Binomial
pub fn new(n: usize, p: f64) -> Self
[src]
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
.
pub fn with_failure(n: usize, q: f64) -> Self
[src]
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.
pub fn n(&self) -> usize
[src]
pub fn n(&self) -> usize
Return the number of trials.
pub fn p(&self) -> f64
[src]
pub fn p(&self) -> f64
Return the success probability.
pub fn q(&self) -> f64
[src]
pub fn q(&self) -> f64
Return the failure probability.
Trait Implementations
impl Clone for Binomial
[src]
impl Clone for Binomial
fn clone(&self) -> Binomial
[src]
fn clone(&self) -> Binomial
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl Copy for Binomial
[src]
impl Copy for Binomial
impl Debug for Binomial
[src]
impl Debug for Binomial
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Discrete for Binomial
[src]
impl Discrete for Binomial
fn mass(&self, x: usize) -> f64
[src]
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,”
impl Distribution for Binomial
[src]
impl Distribution for Binomial
type Value = usize
The type of outcomes.
fn distribution(&self, x: f64) -> f64
[src]
fn distribution(&self, x: f64) -> f64
Compute the cumulative distribution function.
The implementation is based on the incomplete beta function.
impl Entropy for Binomial
[src]
impl Entropy for Binomial
impl Inverse for Binomial
[src]
impl Inverse for Binomial
fn inverse(&self, p: f64) -> usize
[src]
fn inverse(&self, p: f64) -> usize
Compute the inverse of the cumulative distribution function.
For small n
, a simple summation is utilized. For large n
and large
variances, a normal asymptotic approximation is used. Otherwise, the
Newton method is employed.
References
- S. Moorhead, “Efficient evaluation of the inverse binomial cumulative distribution function where the number of trials is large,” Oxford University, 2013.
impl Kurtosis for Binomial
[src]
impl Kurtosis for Binomial
impl Mean for Binomial
[src]
impl Mean for Binomial
impl Median for Binomial
[src]
impl Median for Binomial
impl Modes for Binomial
[src]
impl Modes for Binomial
impl Sample for Binomial
[src]
impl Sample for Binomial
impl Skewness for Binomial
[src]
impl Skewness for Binomial
impl Variance for Binomial
[src]
impl Variance for Binomial