Struct statrs::statistics::Data [−][src]
pub struct Data<D>(_);
Implementations
Trait Implementations
impl<D: AsMut<[f64]> + AsRef<[f64]>> Distribution<f64> for Data<D>
[src]
impl<D: AsMut<[f64]> + AsRef<[f64]>> Distribution<f64> for Data<D>
[src]fn mean(&self) -> Option<f64>
[src]
fn mean(&self) -> Option<f64>
[src]Evaluates the sample mean, an estimate of the population mean.
Remarks
Returns f64::NAN
if data is empty or an entry is f64::NAN
Examples
#[macro_use] extern crate statrs; use statrs::statistics::Distribution; use statrs::statistics::Data; let x = []; let x = Data::new(x); assert!(x.mean().unwrap().is_nan()); let y = [0.0, f64::NAN, 3.0, -2.0]; let y = Data::new(y); assert!(y.mean().unwrap().is_nan()); let z = [0.0, 3.0, -2.0]; let z = Data::new(z); assert_almost_eq!(z.mean().unwrap(), 1.0 / 3.0, 1e-15);
fn variance(&self) -> Option<f64>
[src]
fn variance(&self) -> Option<f64>
[src]Estimates the unbiased population variance from the provided samples
Remarks
On a dataset of size N
, N-1
is used as a normalizer (Bessel’s
correction).
Returns f64::NAN
if data has less than two entries or if any entry is
f64::NAN
Examples
use statrs::statistics::Distribution; use statrs::statistics::Data; let x = []; let x = Data::new(x); assert!(x.variance().unwrap().is_nan()); let y = [0.0, f64::NAN, 3.0, -2.0]; let y = Data::new(y); assert!(y.variance().unwrap().is_nan()); let z = [0.0, 3.0, -2.0]; let z = Data::new(z); assert_eq!(z.variance().unwrap(), 19.0 / 3.0);
impl<D: AsRef<[f64]>> Distribution<f64> for Data<D>
[src]
impl<D: AsRef<[f64]>> Distribution<f64> for Data<D>
[src]fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> f64
[src]
fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> f64
[src]Generate a random value of T
, using rng
as the source of randomness.
fn sample_iter<R>(self, rng: R) -> DistIter<Self, R, T> where
R: Rng,
[src]
fn sample_iter<R>(self, rng: R) -> DistIter<Self, R, T> where
R: Rng,
[src]Create an iterator that generates random values of T
, using rng
as
the source of randomness. Read more
impl<D: AsMut<[f64]> + AsRef<[f64]>> Max<f64> for Data<D>
[src]
impl<D: AsMut<[f64]> + AsRef<[f64]>> Max<f64> for Data<D>
[src]fn max(&self) -> f64
[src]
fn max(&self) -> f64
[src]Returns the maximum value in the data
Remarks
Returns f64::NAN
if data is empty or an entry is f64::NAN
Examples
use statrs::statistics::Max; use statrs::statistics::Data; let x = []; let x = Data::new(x); assert!(x.max().is_nan()); let y = [0.0, f64::NAN, 3.0, -2.0]; let y = Data::new(y); assert!(y.max().is_nan()); let z = [0.0, 3.0, -2.0]; let z = Data::new(z); assert_eq!(z.max(), 3.0);
impl<D: AsMut<[f64]> + AsRef<[f64]> + Clone> Median<f64> for Data<D>
[src]
impl<D: AsMut<[f64]> + AsRef<[f64]> + Clone> Median<f64> for Data<D>
[src]impl<D: AsMut<[f64]> + AsRef<[f64]>> Min<f64> for Data<D>
[src]
impl<D: AsMut<[f64]> + AsRef<[f64]>> Min<f64> for Data<D>
[src]fn min(&self) -> f64
[src]
fn min(&self) -> f64
[src]Returns the minimum value in the data
Remarks
Returns f64::NAN
if data is empty or an entry is f64::NAN
Examples
use statrs::statistics::Min; use statrs::statistics::Data; let x = []; let x = Data::new(x); assert!(x.min().is_nan()); let y = [0.0, f64::NAN, 3.0, -2.0]; let y = Data::new(y); assert!(y.min().is_nan()); let z = [0.0, 3.0, -2.0]; let z = Data::new(z); assert_eq!(z.min(), -2.0);
impl<D: AsMut<[f64]> + AsRef<[f64]>> OrderStatistics<f64> for Data<D>
[src]
impl<D: AsMut<[f64]> + AsRef<[f64]>> OrderStatistics<f64> for Data<D>
[src]fn order_statistic(&mut self, order: usize) -> f64
[src]
fn order_statistic(&mut self, order: usize) -> f64
[src]Returns the order statistic (order 1..N)
from the data Read more
fn quantile(&mut self, tau: f64) -> f64
[src]
fn quantile(&mut self, tau: f64) -> f64
[src]Estimates the tau-th quantile from the data. The tau-th quantile is the data value where the cumulative distribution function crosses tau. Read more
fn percentile(&mut self, p: usize) -> f64
[src]
fn percentile(&mut self, p: usize) -> f64
[src]Estimates the p-Percentile value from the data. Read more
fn lower_quartile(&mut self) -> f64
[src]
fn lower_quartile(&mut self) -> f64
[src]Estimates the first quartile value from the data. Read more
fn upper_quartile(&mut self) -> f64
[src]
fn upper_quartile(&mut self) -> f64
[src]Estimates the third quartile value from the data. Read more
fn interquartile_range(&mut self) -> f64
[src]
fn interquartile_range(&mut self) -> f64
[src]Estimates the inter-quartile range from the data. Read more
impl<D: Eq> Eq for Data<D>
[src]
impl<D> StructuralEq for Data<D>
[src]
impl<D> StructuralPartialEq for Data<D>
[src]
Auto Trait Implementations
impl<D> RefUnwindSafe for Data<D> where
D: RefUnwindSafe,
D: RefUnwindSafe,
impl<D> Send for Data<D> where
D: Send,
D: Send,
impl<D> Sync for Data<D> where
D: Sync,
D: Sync,
impl<D> Unpin for Data<D> where
D: Unpin,
D: Unpin,
impl<D> UnwindSafe for Data<D> where
D: UnwindSafe,
D: UnwindSafe,
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> Same<T> for T
impl<T> Same<T> for T
type Output = 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 to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct self
from the equivalent element of its
superset. Read more
pub fn is_in_subset(&self) -> bool
pub fn is_in_subset(&self) -> bool
Checks if self
is actually part of its subset T
(and can be converted to it).
pub fn to_subset_unchecked(&self) -> SS
pub fn to_subset_unchecked(&self) -> SS
Use with care! Same as self.to_subset
but without any property checks. Always succeeds.
pub fn from_subset(element: &SS) -> SP
pub fn from_subset(element: &SS) -> SP
The inclusion map: converts self
to the equivalent element of its superset.
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
[src]type Owned = T
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn to_owned(&self) -> T
[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)
[src]
pub fn clone_into(&self, target: &mut T)
[src]🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,