Struct probability::distribution::Binomial [−][src]
A binomial distribution.
Implementations
impl Binomial
[src]
pub fn new(n: usize, p: f64) -> Self
[src]
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]
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]
Return the number of trials.
pub fn p(&self) -> f64
[src]
Return the success probability.
pub fn q(&self) -> f64
[src]
Return the failure probability.
Trait Implementations
impl Clone for Binomial
[src]
impl Copy for Binomial
[src]
impl Debug for Binomial
[src]
impl Discrete for Binomial
[src]
fn mass(&self, x: usize) -> f64
[src]
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]
type Value = usize
The type of outcomes.
fn distribution(&self, x: f64) -> f64
[src]
Compute the cumulative distribution function.
The implementation is based on the incomplete beta function.
impl Entropy for Binomial
[src]
impl Inverse for Binomial
[src]
fn inverse(&self, p: f64) -> usize
[src]
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 Mean for Binomial
[src]
impl Median for Binomial
[src]
impl Modes for Binomial
[src]
impl Sample for Binomial
[src]
impl Skewness for Binomial
[src]
impl Variance for Binomial
[src]
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
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,