Distribution

Trait Distribution 

Source
pub trait Distribution {
Show 14 methods // Required methods fn cf(&self, t: f64) -> Complex<f64>; fn pdf(&self, x: f64) -> f64; fn pmf(&self, x: f64) -> f64; fn cdf(&self, x: f64) -> f64; fn inv_cdf(&self, p: f64) -> f64; fn mean(&self) -> f64; fn median(&self) -> f64; fn mode(&self) -> f64; fn variance(&self) -> f64; fn skewness(&self) -> f64; fn kurtosis(&self) -> f64; fn entropy(&self) -> f64; fn mgf(&self, t: f64) -> f64; fn sample(&self, n: usize) -> Result<Vec<f64>, RustQuantError>;
}
Expand description

Base trait for all distributions. Provides common methods for all distributions. All distributions must implement this trait.

Required Methods§

Source

fn cf(&self, t: f64) -> Complex<f64>

Characteristic function of the distribution. Returns the value of the characteristic function at t. The characteristic function is defined as:
cf(t) = E[e^{itX}]

Source

fn pdf(&self, x: f64) -> f64

Probability density function of the distribution. Returns the probability that a random variable is equal to x. NOTE: Panics if the distribution is discrete.

Source

fn pmf(&self, x: f64) -> f64

Probability mass function of the distribution. Returns the probability that a random variable is equal to x. NOTE: Panics if the distribution is continuous.

Source

fn cdf(&self, x: f64) -> f64

Distribution function of the distribution. Returns the probability that a random variable is less than or equal to x.

Source

fn inv_cdf(&self, p: f64) -> f64

Inverse distribution function of the distribution. Returns the value of x such that cdf(x) = p.

Source

fn mean(&self) -> f64

Returns the mean of the distribution. Mean is the average value of the distribution. https://en.wikipedia.org/wiki/Mean

Source

fn median(&self) -> f64

Returns the median of the distribution. Median is the value that splits the distribution into two equal parts. https://en.wikipedia.org/wiki/Median

Source

fn mode(&self) -> f64

Returns the mode of the distribution. Mode is the value that maximizes the probability density function. https://en.wikipedia.org/wiki/Mode_(statistics)

Source

fn variance(&self) -> f64

Returns the variance of the distribution. Variance is a measure of the spread of the distribution. https://en.wikipedia.org/wiki/Variance

Source

fn skewness(&self) -> f64

Returns the skewness of the distribution. Skewness is a measure of the asymmetry of the distribution. https://en.wikipedia.org/wiki/Skewness

Source

fn kurtosis(&self) -> f64

Returns the kurtosis of the distribution. Kurtosis is a measure of the “tailedness” of the distribution. https://en.wikipedia.org/wiki/Kurtosis

Source

fn entropy(&self) -> f64

Returns the entropy of the distribution. Entropy is a measure of the uncertainty of the distribution.

Source

fn mgf(&self, t: f64) -> f64

Moment generating function of the distribution. M = E[e^{tX}] https://en.wikipedia.org/wiki/Moment-generating_function

Source

fn sample(&self, n: usize) -> Result<Vec<f64>, RustQuantError>

Generates a random sample from the distribution.

Implementors§