Trait statrs::distribution::Discrete
source · [−]Expand description
The Discrete
trait provides an interface for interacting with discrete
statistical distributions
Remarks
All methods provided by the Discrete
trait are unchecked, meaning
they can panic if in an invalid state or encountering invalid input
depending on the implementing distribution.
Required methods
Returns the probability mass function calculated at x
for a given
distribution.
May panic depending on the implementor.
Examples
use statrs::distribution::{Discrete, Binomial};
use statrs::prec;
let n = Binomial::new(0.5, 10).unwrap();
assert!(prec::almost_eq(n.pmf(5), 0.24609375, 1e-15));
Returns the log of the probability mass function calculated at x
for
a given distribution.
May panic depending on the implementor.
Examples
use statrs::distribution::{Discrete, Binomial};
use statrs::prec;
let n = Binomial::new(0.5, 10).unwrap();
assert!(prec::almost_eq(n.ln_pmf(5), (0.24609375f64).ln(), 1e-15));