Trait rv::traits::ContinuousDistr [−][src]
pub trait ContinuousDistr<X>: Rv<X> + Support<X> { fn pdf(&self, x: &X) -> f64 { ... } fn ln_pdf(&self, x: &X) -> f64 { ... } }
Is a continuous probability distributions
This trait uses the Rv<X>
and Support<X>
implementations to implement
itself.
Provided Methods
fn pdf(&self, x: &X) -> f64
The value of the Probability Density Function (PDF) at x
Panics
If x
is not in the support.
Example
Compute the Gaussian PDF, f(x)
use rv::dist::Gaussian; use rv::traits::ContinuousDistr; let g = Gaussian::standard(); let f_mean = g.pdf(&0.0_f64); let f_low = g.pdf(&-1.0_f64); let f_high = g.pdf(&1.0_f64); assert!(f_mean > f_low); assert!(f_mean > f_high); assert!((f_low - f_high).abs() < 1E-12);
fn ln_pdf(&self, x: &X) -> f64
The value of the log Probability Density Function (PDF) at x
Panics
If x
is not in the support.
Example
Compute the natural logarithm of the Gaussian PDF, ln(f(x))
use rv::dist::Gaussian; use rv::traits::ContinuousDistr; let g = Gaussian::standard(); let lnf_mean = g.ln_pdf(&0.0_f64); let lnf_low = g.ln_pdf(&-1.0_f64); let lnf_high = g.ln_pdf(&1.0_f64); assert!(lnf_mean > lnf_low); assert!(lnf_mean > lnf_high); assert!((lnf_low - lnf_high).abs() < 1E-12);
Implementors
impl ContinuousDistr<f32> for Beta
impl ContinuousDistr<f64> for Beta
impl ContinuousDistr<f64> for Cauchy
impl ContinuousDistr<f32> for Cauchy
impl ContinuousDistr<f64> for ChiSquared
impl ContinuousDistr<f32> for ChiSquared
impl ContinuousDistr<Vec<f64>> for SymmetricDirichlet
impl ContinuousDistr<Vec<f64>> for Dirichlet
impl ContinuousDistr<f64> for Exponential
impl ContinuousDistr<f32> for Exponential
impl ContinuousDistr<f32> for Gamma
impl ContinuousDistr<f64> for Gamma
impl ContinuousDistr<f32> for Gaussian
impl ContinuousDistr<f64> for Gaussian
impl ContinuousDistr<f32> for Gev
impl ContinuousDistr<f64> for Gev
impl ContinuousDistr<f32> for InvGamma
impl ContinuousDistr<f64> for InvGamma
impl ContinuousDistr<f64> for Laplace
impl ContinuousDistr<f32> for Laplace
impl ContinuousDistr<f32> for LogNormal
impl ContinuousDistr<f64> for LogNormal
impl<X, Fx> ContinuousDistr<X> for Mixture<Fx> where
Fx: Rv<X> + ContinuousDistr<X>,impl ContinuousDistr<DVector<f64>> for MvGaussian
impl ContinuousDistr<MvGaussian> for NormalInvWishart
impl ContinuousDistr<Gaussian> for NormalGamma
impl ContinuousDistr<f32> for Pareto
impl ContinuousDistr<f64> for Pareto
impl ContinuousDistr<f64> for StudentsT
impl ContinuousDistr<f32> for StudentsT
impl ContinuousDistr<f64> for Uniform
impl ContinuousDistr<f32> for Uniform
impl ContinuousDistr<f32> for VonMises
impl ContinuousDistr<f64> for VonMises
impl ContinuousDistr<DMatrix<f64>> for InvWishart
impl ContinuousDistr<Bernoulli> for Beta