pub trait DistributionMethods: Distribution {
// Required methods
fn mean(&self) -> Array1<f64>;
fn variance(&self) -> Array1<f64>;
fn pdf(&self, y: &Array1<f64>) -> Array1<f64>;
fn cdf(&self, y: &Array1<f64>) -> Array1<f64>;
fn ppf(&self, q: &Array1<f64>) -> Array1<f64>;
fn sample(&self, n_samples: usize) -> Array2<f64>;
// Provided methods
fn std(&self) -> Array1<f64> { ... }
fn logpdf(&self, y: &Array1<f64>) -> Array1<f64> { ... }
fn interval(&self, alpha: f64) -> (Array1<f64>, Array1<f64>) { ... }
fn sf(&self, y: &Array1<f64>) -> Array1<f64> { ... }
fn median(&self) -> Array1<f64> { ... }
fn mode(&self) -> Array1<f64> { ... }
}Expand description
A trait providing common distribution helper methods.
This trait provides scipy-like methods for distributions:
mean(),std(),var()- momentspdf(),logpdf()- probability density functionscdf()- cumulative distribution functionppf()- percent point function (inverse CDF / quantile function)sample()- random samplinginterval()- confidence intervals
Required Methods§
Sourcefn variance(&self) -> Array1<f64>
fn variance(&self) -> Array1<f64>
Returns the variance of the distribution for each observation.
Sourcefn pdf(&self, y: &Array1<f64>) -> Array1<f64>
fn pdf(&self, y: &Array1<f64>) -> Array1<f64>
Evaluates the probability density function at point y for each observation.
Sourcefn cdf(&self, y: &Array1<f64>) -> Array1<f64>
fn cdf(&self, y: &Array1<f64>) -> Array1<f64>
Evaluates the cumulative distribution function at point y for each observation.
Provided Methods§
Sourcefn std(&self) -> Array1<f64>
fn std(&self) -> Array1<f64>
Returns the standard deviation of the distribution for each observation.
Sourcefn logpdf(&self, y: &Array1<f64>) -> Array1<f64>
fn logpdf(&self, y: &Array1<f64>) -> Array1<f64>
Evaluates the log probability density function at point y for each observation.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.