pub struct GeoDist {
pub p: f64,
}Expand description
Struct for the geometric distribution X ~ Geo(p) where
X = the number of failures prior to observing the first success.
§Parameters
p= probability of success (0 < p <= 1)
§Support
x = 0,1,2,...
§Example
Suppose X ~ Geo(p=0.2). Use
use ruststat::GeoDist;
let mut mygeo = GeoDist{p:0.2};
println!("probability mass function: {}", mygeo.pmf(8));
println!("cumulative distribution function: {}", mygeo.cdf(8));
println!("percentile: {}", mygeo.per(0.99));
println!("random: {}", mygeo.ran());
println!("Random vector: {:?}", mygeo.ranvec(5));
println!("mean: {}", mygeo.mean());
println!("variance: {}", mygeo.var());
println!("standard deviation: {}", mygeo.sd());Fields§
§p: f64Implementations§
Source§impl GeoDist
impl GeoDist
pub fn pmf(&mut self, x: u64) -> f64
pub fn cdf(&mut self, x: u64) -> f64
pub fn per(&mut self, q: f64) -> u64
pub fn ran(&mut self) -> u64
pub fn ranvec(&mut self, n: u64) -> Vec<u64>
pub fn mean(&mut self) -> f64
pub fn var(&mut self) -> f64
pub fn sd(&mut self) -> f64
Auto Trait Implementations§
impl Freeze for GeoDist
impl RefUnwindSafe for GeoDist
impl Send for GeoDist
impl Sync for GeoDist
impl Unpin for GeoDist
impl UnsafeUnpin for GeoDist
impl UnwindSafe for GeoDist
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more