Struct rv::dist::InvGamma [−][src]
pub struct InvGamma { /* fields omitted */ }
Inverse gamma distribution IG(α, β) over x in (0, ∞).
β^α
f(x|α, β) = ---- x^(-α-1) e^(-β/x)
Γ(α)
Implementations
impl InvGamma
[src]
impl InvGamma
[src]pub fn new(shape: f64, scale: f64) -> Result<Self, InvGammaError>
[src]
Create a new Gamma
distribution with shape (α) and rate (β).
Arguments
- shape: shape parameter, α
- scale scale parameter, β
pub fn new_unchecked(shape: f64, scale: f64) -> Self
[src]
Creates a new InvGamma without checking whether the parameters are valid.
pub fn shape(&self) -> f64
[src]
Get the shape paramter
Example
let ig = InvGamma::new(1.0, 2.0).unwrap(); assert_eq!(ig.shape(), 1.0);
pub fn set_shape(&mut self, shape: f64) -> Result<(), InvGammaError>
[src]
Set the shape parameter
Example
let mut ig = InvGamma::new(2.0, 1.0).unwrap(); assert_eq!(ig.shape(), 2.0); ig.set_shape(1.1).unwrap(); assert_eq!(ig.shape(), 1.1);
Will error for invalid values
assert!(ig.set_shape(1.1).is_ok()); assert!(ig.set_shape(0.0).is_err()); assert!(ig.set_shape(-1.0).is_err()); assert!(ig.set_shape(std::f64::INFINITY).is_err()); assert!(ig.set_shape(std::f64::NEG_INFINITY).is_err()); assert!(ig.set_shape(std::f64::NAN).is_err());
pub fn set_shape_unchecked(&mut self, shape: f64)
[src]
Set the shape parameter without input validation
pub fn scale(&self) -> f64
[src]
Get the scale parameter
Example
let ig = InvGamma::new(1.0, 2.0).unwrap(); assert_eq!(ig.scale(), 2.0);
pub fn set_scale(&mut self, scale: f64) -> Result<(), InvGammaError>
[src]
Set the scale parameter
Example
let mut ig = InvGamma::new(2.0, 1.0).unwrap(); assert_eq!(ig.scale(), 1.0); ig.set_scale(1.1).unwrap(); assert_eq!(ig.scale(), 1.1);
Will error for invalid values
assert!(ig.set_scale(1.1).is_ok()); assert!(ig.set_scale(0.0).is_err()); assert!(ig.set_scale(-1.0).is_err()); assert!(ig.set_scale(std::f64::INFINITY).is_err()); assert!(ig.set_scale(std::f64::NEG_INFINITY).is_err()); assert!(ig.set_scale(std::f64::NAN).is_err());
pub fn set_scale_unchecked(&mut self, scale: f64)
[src]
Set the scale parameter without input validation
Trait Implementations
impl ContinuousDistr<f32> for InvGamma
[src]
impl ContinuousDistr<f32> for InvGamma
[src]impl ContinuousDistr<f64> for InvGamma
[src]
impl ContinuousDistr<f64> for InvGamma
[src]impl StructuralPartialEq for InvGamma
[src]
impl StructuralPartialEq for InvGamma
[src]Auto Trait Implementations
impl RefUnwindSafe for InvGamma
impl RefUnwindSafe for InvGamma
impl UnwindSafe for InvGamma
impl UnwindSafe for InvGamma
Blanket Implementations
impl<T> Same<T> for T
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
pub fn to_subset(&self) -> Option<SS>
pub fn is_in_subset(&self) -> bool
pub fn to_subset_unchecked(&self) -> SS
pub fn from_subset(element: &SS) -> SP
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,