[][src]Trait rstat::Distribution

pub trait Distribution: From<Self::Params> {
    type Support: Space;
    type Params;
    fn support(&self) -> Self::Support;
fn params(&self) -> Self::Params;
fn cdf(&self, x: &Sample<Self>) -> Probability;
fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> Sample<Self>; fn into_support(self) -> Self::Support { ... }
fn into_params(self) -> Self::Params { ... }
fn ccdf(&self, x: &Sample<Self>) -> Probability { ... }
fn log_cdf(&self, x: &Sample<Self>) -> f64 { ... }
fn log_ccdf(&self, x: &Sample<Self>) -> f64 { ... }
fn sample_n<R: Rng + ?Sized>(
        &self,
        rng: &mut R,
        n: usize
    ) -> Vec<Sample<Self>> { ... }
fn sample_iter<'a, R: Rng + ?Sized>(
        &'a self,
        rng: &'a mut R
    ) -> Sampler<'a, Self, R> { ... } }

Trait for probability distributions with a well-defined CDF.

Associated Types

type Support: Space

Support of sample elements.

type Params

Parameter set uniquely defining the instance.

Loading content...

Required methods

fn support(&self) -> Self::Support

Returns an instance of the support Space, Self::Support.

fn params(&self) -> Self::Params

Returns an instance of Self::Params matching the parameters of self.

fn cdf(&self, x: &Sample<Self>) -> Probability

Evaluates the cumulative distribution function (CDF) at \(x\).

The CDF is defined as the probability that a random variable \(X\) takes on a value less than or equal to \(x\), i.e. \(F(x) = P(X \leq x)\).

fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> Sample<Self>

Draw a random value from the distribution support.

Loading content...

Provided methods

fn into_support(self) -> Self::Support

fn into_params(self) -> Self::Params

fn ccdf(&self, x: &Sample<Self>) -> Probability

Evaluates the complementary CDF at \(x\).

The complementary CDF (also known as the survival function) is defined as the probability that a random variable \(X\) takes on a value strictly greater than \(x\), i.e. \(\bar{F}(x) = P(X > x) = 1 - F(x)\).

fn log_cdf(&self, x: &Sample<Self>) -> f64

Evaluates the log CDF at \(x\), i.e. \(\ln{F(x)}\).

fn log_ccdf(&self, x: &Sample<Self>) -> f64

Evaluates the log complementary CDF at \(x\), i.e. \(\ln{(1 - F(x))}\).

fn sample_n<R: Rng + ?Sized>(&self, rng: &mut R, n: usize) -> Vec<Sample<Self>>

Draw n random value from the distribution support.

fn sample_iter<'a, R: Rng + ?Sized>(
    &'a self,
    rng: &'a mut R
) -> Sampler<'a, Self, R>

Draw an indefinite number of random values from the distribution support.

Loading content...

Implementors

impl Distribution for Dirichlet[src]

impl Distribution for Multinomial[src]

type Support = ProductSpace<Ordinal>

type Params = Params

impl Distribution for Arcsine[src]

type Support = Interval

type Params = Params

impl Distribution for Bernoulli[src]

type Support = Binary

type Params = Probability

impl Distribution for Beta[src]

type Support = Interval

type Params = Params

impl Distribution for BetaBinomial[src]

type Support = Ordinal

type Params = Params

impl Distribution for BetaPrime[src]

type Support = PositiveReals

type Params = Params

impl Distribution for Binomial[src]

type Support = Ordinal

type Params = Params

impl Distribution for Categorical[src]

type Support = Ordinal

type Params = SimplexVector

impl Distribution for Cauchy[src]

type Support = Reals

type Params = Params

impl Distribution for Chi[src]

type Support = PositiveReals

type Params = DOF<usize>

impl Distribution for ChiSq[src]

type Support = PositiveReals

type Params = DOF<usize>

impl Distribution for Cosine[src]

type Support = Interval

type Params = Params

impl Distribution for Degenerate<f64>[src]

type Support = Reals

type Params = Loc<f64>

impl Distribution for Degenerate<i64>[src]

type Support = Integers

type Params = Loc<i64>

impl Distribution for Erlang[src]

type Support = PositiveReals

type Params = Params

impl Distribution for Exponential[src]

type Support = PositiveReals

type Params = Rate<f64>

impl Distribution for FDist[src]

type Support = PositiveReals

type Params = Params

impl Distribution for FoldedNormal[src]

type Support = NonNegativeReals

type Params = Params

impl Distribution for Frechet[src]

type Support = Interval

type Params = Shape<f64>

impl Distribution for Gamma[src]

type Support = PositiveReals

type Params = Params

impl Distribution for Geometric[src]

impl Distribution for GeneralisedExtremeValue[src]

type Support = Interval

type Params = Params

impl Distribution for GeneralisedPareto[src]

type Support = Interval

type Params = Params

impl Distribution for Gumbel[src]

type Support = Reals

type Params = Params

impl Distribution for InvGamma[src]

type Support = PositiveReals

type Params = Params

impl Distribution for InvNormal[src]

type Support = PositiveReals

type Params = Params

impl Distribution for Kumaraswamy[src]

type Support = Interval

type Params = Params

impl Distribution for Laplace[src]

type Support = Reals

type Params = Params

impl Distribution for Levy[src]

type Support = Interval

type Params = Params

impl Distribution for Logistic[src]

type Support = Reals

type Params = Params

impl Distribution for rstat::univariate::lognormal::LogNormal[src]

type Support = PositiveReals

type Params = Params

impl Distribution for Normal[src]

type Support = Reals

type Params = Params

impl Distribution for Pareto[src]

type Support = Interval

type Params = Params

impl Distribution for Poisson[src]

type Support = Naturals

type Params = Rate<f64>

impl Distribution for Rayleigh[src]

type Support = PositiveReals

type Params = Shape<f64>

impl Distribution for StudentT[src]

type Support = Reals

type Params = Loc<f64>

impl Distribution for Triangular[src]

type Support = Interval

type Params = Params

impl Distribution for Uniform<f64>[src]

type Support = RealInterval

type Params = Params<f64>

impl Distribution for Uniform<i64>[src]

type Support = DiscreteInterval

type Params = Params<i64>

impl Distribution for Weibull[src]

type Support = PositiveReals

type Params = Params

impl Distribution for DiagonalNormal[src]

type Support = ProductSpace<Reals>

type Params = Params<Array1<f64>>

impl Distribution for FullNormal[src]

type Support = ProductSpace<Reals>

type Params = Params<Array2<f64>>

impl Distribution for IsotropicNormal[src]

type Support = ProductSpace<Reals>

type Params = Params<f64>

impl<C: Distribution> Distribution for Mixture<C> where
    C::Support: Union + Clone
[src]

type Support = C::Support

type Params = Params<C::Params>

impl<S> Distribution for rstat::multivariate::lognormal::LogNormal<S> where
    Normal<S>: From<Params<S>> + Distribution<Support = ProductSpace<Reals>, Params = Params<S>>, 
[src]

type Support = ProductSpace<Reals>

type Params = Params<S>

Loading content...