Struct statrs::distribution::InverseGamma [−][src]
pub struct InverseGamma { /* fields omitted */ }
Implements the Inverse Gamma distribution
Examples
use statrs::distribution::{InverseGamma, Continuous}; use statrs::statistics::Mean; use statrs::prec; let n = InverseGamma::new(1.1, 0.1).unwrap(); assert!(prec::almost_eq(n.mean(), 1.0, 1e-14)); assert_eq!(n.pdf(1.0), 0.07554920138253064);
Implementations
impl InverseGamma
[src]
impl InverseGamma
[src]pub fn new(shape: f64, rate: f64) -> Result<InverseGamma>
[src][−]
Constructs a new inverse gamma distribution with a shape (α)
of shape
and a rate (β) of rate
Errors
Returns an error if shape
or rate
are NaN
.
Also returns an error if shape
or rate
are not in (0, +inf)
Examples
use statrs::distribution::InverseGamma; let mut result = InverseGamma::new(3.0, 1.0); assert!(result.is_ok()); result = InverseGamma::new(0.0, 0.0); assert!(result.is_err());
pub fn shape(&self) -> f64
[src][−]
Returns the shape (α) of the inverse gamma distribution
Examples
use statrs::distribution::InverseGamma; let n = InverseGamma::new(3.0, 1.0).unwrap(); assert_eq!(n.shape(), 3.0);
pub fn rate(&self) -> f64
[src][−]
Returns the rate (β) of the inverse gamma distribution
Examples
use statrs::distribution::InverseGamma; let n = InverseGamma::new(3.0, 1.0).unwrap(); assert_eq!(n.rate(), 1.0);
Trait Implementations
impl CheckedMean<f64> for InverseGamma
[src]
impl CheckedMean<f64> for InverseGamma
[src]impl CheckedSkewness<f64> for InverseGamma
[src]
impl CheckedSkewness<f64> for InverseGamma
[src]impl CheckedVariance<f64> for InverseGamma
[src]
impl CheckedVariance<f64> for InverseGamma
[src]impl Clone for InverseGamma
[src]
impl Clone for InverseGamma
[src]fn clone(&self) -> InverseGamma
[src][−]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src][−]
impl Continuous<f64, f64> for InverseGamma
[src]
impl Continuous<f64, f64> for InverseGamma
[src]fn pdf(&self, x: f64) -> f64
[src][−]
Calculates the probability density function for the
inverse gamma distribution at x
Formula
ⓘ
(β^α / Γ(α)) * x^(-α - 1) * e^(-β / x)
where α
is the shape, β
is the rate, and Γ
is the gamma function
fn ln_pdf(&self, x: f64) -> f64
[src][−]
Calculates the probability density function for the
inverse gamma distribution at x
Formula
ⓘ
ln((β^α / Γ(α)) * x^(-α - 1) * e^(-β / x))
where α
is the shape, β
is the rate, and Γ
is the gamma function
impl Distribution<f64> for InverseGamma
[src]
impl Distribution<f64> for InverseGamma
[src]impl Entropy<f64> for InverseGamma
[src]
impl Entropy<f64> for InverseGamma
[src]impl Max<f64> for InverseGamma
[src]
impl Max<f64> for InverseGamma
[src]impl Mean<f64> for InverseGamma
[src]
impl Mean<f64> for InverseGamma
[src]impl Min<f64> for InverseGamma
[src]
impl Min<f64> for InverseGamma
[src]impl Mode<f64> for InverseGamma
[src]
impl Mode<f64> for InverseGamma
[src]impl PartialEq<InverseGamma> for InverseGamma
[src]
impl PartialEq<InverseGamma> for InverseGamma
[src]fn eq(&self, other: &InverseGamma) -> bool
[src][−]
fn ne(&self, other: &InverseGamma) -> bool
[src][−]
impl Skewness<f64> for InverseGamma
[src]
impl Skewness<f64> for InverseGamma
[src]impl Univariate<f64, f64> for InverseGamma
[src]
impl Univariate<f64, f64> for InverseGamma
[src]impl Variance<f64> for InverseGamma
[src]
impl Variance<f64> for InverseGamma
[src]