[−][src]Struct rv::dist::Kumaraswamy
Kumaraswamy distribution, Kumaraswamy(α, β) over x in (0, 1).
Examples
The relationship between the CDF and the inverse CDF.
let kuma = Kumaraswamy::new(2.1, 3.4).unwrap(); let x = 0.6_f64; let p: f64 = kuma.cdf(&x); let y: f64 = kuma.invcdf(p); assert::close(x, y, 1E-10);
Kumaraswamy(a, 1) is equivalent to Beta(a, 1) and Kumaraswamy(1, b) is equivalent to Beta(1, b)
let kuma = Kumaraswamy::new(1.0, 3.5).unwrap(); let beta = Beta::new(1.0, 3.5).unwrap(); let xs = rv::misc::linspace(0.1, 0.9, 10); for x in xs.iter() { assert::close(kuma.f(x), beta.f(x), 1E-10); }
Methods
impl Kumaraswamy
[src]
pub fn new(a: f64, b: f64) -> Result<Self>
[src]
Create a Beta
distribution with even density over (0, 1).
Example
let kuma_good = Kumaraswamy::new(1.0, 1.0); assert!(kuma_good.is_ok()); // Invalid negative parameter let kuma_bad = Kumaraswamy::new(-5.0, 1.0); assert!(kuma_bad.is_err());
pub fn new_unchecked(a: f64, b: f64) -> Self
[src]
Creates a new Kumaraswamy without checking whether the parameters are valid.
pub fn uniform() -> Self
[src]
Create a Kumaraswamy
distribution with even density over (0, 1).
Example
let kuma = Kumaraswamy::uniform(); assert_eq!(kuma, Kumaraswamy::new(1.0, 1.0).unwrap());
pub fn centered(a: f64) -> Result<Self>
[src]
Create a Kumaraswamy
distribution with median 0.5
Notes
The distribution will not necessarily be symmetrical about x = 0.5, i.e., for c < 0.5, f(0.5 - c) may not equal f(0.5 + c).
Examples
// Bowl-shaped let kuma_1 = Kumaraswamy::centered(0.5).unwrap(); let median_1: f64 = kuma_1.median().unwrap(); assert::close(median_1, 0.5, 1E-10); assert::close(kuma_1.cdf(&0.5), 0.5, 1E-10); assert::close(kuma_1.b(), 0.5644763825137, 1E-10); // Cone-shaped let kuma_2 = Kumaraswamy::centered(2.0).unwrap(); let median_2: f64 = kuma_2.median().unwrap(); assert::close(median_2, 0.5, 1E-10); assert::close(kuma_2.cdf(&0.5), 0.5, 1E-10); assert::close(kuma_2.b(), 2.409420839653209, 1E-10);
The PDF will most likely not be symmetrical about 0.5
fn absolute_error(a: f64, b: f64) -> f64 { (a - b).abs() } let kuma = Kumaraswamy::centered(2.0).unwrap(); assert!(absolute_error(kuma.f(&0.1), kuma.f(&0.9)) > 1E-8);
pub fn a(&self) -> f64
[src]
Get the a
parameter
Example
let kuma = Kumaraswamy::new(1.0, 5.0).unwrap(); assert_eq!(kuma.a(), 1.0);
pub fn b(&self) -> f64
[src]
Get the b
parameter
Example
let kuma = Kumaraswamy::new(1.0, 5.0).unwrap(); assert_eq!(kuma.b(), 5.0);
pub fn set_a(&mut self, a: f64)
[src]
pub fn set_b(&mut self, b: f64)
[src]
Trait Implementations
impl Rv<f64> for Kumaraswamy
[src]
fn ln_f(&self, x: &f64) -> f64
[src]
fn draw<R: Rng>(&self, rng: &mut R) -> f64
[src]
fn f(&self, x: &X) -> f64
[src]
fn sample<R: Rng>(&self, n: usize, rng: &mut R) -> Vec<X>
[src]
impl Rv<f32> for Kumaraswamy
[src]
fn ln_f(&self, x: &f32) -> f64
[src]
fn draw<R: Rng>(&self, rng: &mut R) -> f32
[src]
fn f(&self, x: &X) -> f64
[src]
fn sample<R: Rng>(&self, n: usize, rng: &mut R) -> Vec<X>
[src]
impl Support<f64> for Kumaraswamy
[src]
impl Support<f32> for Kumaraswamy
[src]
impl ContinuousDistr<f64> for Kumaraswamy
[src]
impl ContinuousDistr<f32> for Kumaraswamy
[src]
impl Cdf<f64> for Kumaraswamy
[src]
impl Cdf<f32> for Kumaraswamy
[src]
impl InverseCdf<f64> for Kumaraswamy
[src]
fn invcdf(&self, p: f64) -> f64
[src]
fn quantile(&self, p: f64) -> X
[src]
fn interval(&self, p: f64) -> (X, X)
[src]
impl InverseCdf<f32> for Kumaraswamy
[src]
fn invcdf(&self, p: f64) -> f32
[src]
fn quantile(&self, p: f64) -> X
[src]
fn interval(&self, p: f64) -> (X, X)
[src]
impl Mean<f64> for Kumaraswamy
[src]
impl Mean<f32> for Kumaraswamy
[src]
impl Median<f64> for Kumaraswamy
[src]
impl Median<f32> for Kumaraswamy
[src]
impl Mode<f64> for Kumaraswamy
[src]
impl Mode<f32> for Kumaraswamy
[src]
impl Entropy for Kumaraswamy
[src]
impl<'_> From<&'_ Kumaraswamy> for String
[src]
fn from(kuma: &Kumaraswamy) -> String
[src]
impl Clone for Kumaraswamy
[src]
fn clone(&self) -> Kumaraswamy
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Default for Kumaraswamy
[src]
impl PartialEq<Kumaraswamy> for Kumaraswamy
[src]
fn eq(&self, other: &Kumaraswamy) -> bool
[src]
fn ne(&self, other: &Kumaraswamy) -> bool
[src]
impl PartialOrd<Kumaraswamy> for Kumaraswamy
[src]
fn partial_cmp(&self, other: &Kumaraswamy) -> Option<Ordering>
[src]
fn lt(&self, other: &Kumaraswamy) -> bool
[src]
fn le(&self, other: &Kumaraswamy) -> bool
[src]
fn gt(&self, other: &Kumaraswamy) -> bool
[src]
fn ge(&self, other: &Kumaraswamy) -> bool
[src]
impl Display for Kumaraswamy
[src]
impl Debug for Kumaraswamy
[src]
Auto Trait Implementations
impl Send for Kumaraswamy
impl Sync for Kumaraswamy
impl Unpin for Kumaraswamy
impl UnwindSafe for Kumaraswamy
impl RefUnwindSafe for Kumaraswamy
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
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.
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>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
SS: SubsetOf<SP>,
fn to_subset(&self) -> Option<SS>
fn is_in_subset(&self) -> bool
unsafe fn to_subset_unchecked(&self) -> SS
fn from_subset(element: &SS) -> SP
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,