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§
Sourcefn cf(&self, t: f64) -> Complex<f64>
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}]
Sourcefn pdf(&self, x: f64) -> f64
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.
Sourcefn pmf(&self, x: f64) -> f64
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.
Sourcefn cdf(&self, x: f64) -> f64
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.
Sourcefn inv_cdf(&self, p: f64) -> f64
fn inv_cdf(&self, p: f64) -> f64
Inverse distribution function of the distribution. Returns the value of x such that cdf(x) = p.
Sourcefn mean(&self) -> f64
fn mean(&self) -> f64
Returns the mean of the distribution. Mean is the average value of the distribution. https://en.wikipedia.org/wiki/Mean
Sourcefn median(&self) -> f64
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
Sourcefn mode(&self) -> f64
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)
Sourcefn variance(&self) -> f64
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
Sourcefn skewness(&self) -> f64
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
Sourcefn kurtosis(&self) -> f64
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
Sourcefn entropy(&self) -> f64
fn entropy(&self) -> f64
Returns the entropy of the distribution. Entropy is a measure of the uncertainty of the distribution.
Sourcefn mgf(&self, t: f64) -> f64
fn mgf(&self, t: f64) -> f64
Moment generating function of the distribution. M = E[e^{tX}] https://en.wikipedia.org/wiki/Moment-generating_function