Struct rv::dist::Empirical [−][src]
pub struct Empirical { /* fields omitted */ }
An empirical distribution derived from samples.
WARNING: The ln_f
and f
methods are poor approximations.
They both are likely be have unbound errors.
use rv::dist::{Gaussian, Empirical}; use rv::prelude::Rv; use rv::misc::linspace; use rand_xoshiro::Xoshiro256Plus; use rand::SeedableRng; let mut rng = Xoshiro256Plus::seed_from_u64(0xABCD); let gen = Gaussian::standard(); let sample: Vec<f64> = gen.sample(1000, &mut rng); let emp_dist = Empirical::new(sample); let ln_f_err: Vec<f64> = linspace(emp_dist.range().0, emp_dist.range().1, 1000) .iter() .map(|x| { gen.ln_f(x) - emp_dist.ln_f(x) }).collect();
Implementations
impl Empirical
[src]
impl Empirical
[src]pub fn new(xs: Vec<f64>) -> Self
[src]
Create a new Empirical distribution with the given observed values
pub fn empcdfs(&self, values: &[f64]) -> Vec<f64>
[src]
Compute the CDF of a number of values
pub fn pp(&self, other: &Self) -> (Vec<f64>, Vec<f64>)
[src]
A utility for computing a P-P plot.
pub fn err(&self, other: &Self) -> f64
[src]
Area between CDF-CDF (1-1) line
pub fn range(&self) -> &(f64, f64)
[src]
Return the range of non-zero support for this distribution.
Trait Implementations
impl PartialOrd<Empirical> for Empirical
[src]
impl PartialOrd<Empirical> for Empirical
[src]impl StructuralPartialEq for Empirical
[src]
impl StructuralPartialEq for Empirical
[src]Auto Trait Implementations
impl RefUnwindSafe for Empirical
impl RefUnwindSafe for Empirical
impl UnwindSafe for Empirical
impl UnwindSafe for Empirical
Blanket Implementations
impl<T> Same<T> for T
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
pub fn to_subset(&self) -> Option<SS>
pub fn is_in_subset(&self) -> bool
pub fn to_subset_unchecked(&self) -> SS
pub fn from_subset(element: &SS) -> SP
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,