Struct statrs::statistics::Data

source ·
pub struct Data<D>(_);

Implementations§

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Generate a random value of T, using rng as the source of randomness.
Create an iterator that generates random values of T, using rng as the source of randomness. Read more
Create a distribution of values of ‘S’ by mapping the output of Self through the closure F Read more

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);

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);
Returns the standard deviation, if it exists. Read more
Returns the entropy, if it exists. Read more
Returns the skewness, if it exists. Read more
The returned type after indexing.
Performs the indexing (container[index]) operation. Read more
Performs the mutable indexing (container[index]) operation. Read more

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);

Returns the median value from the data

Remarks

Returns f64::NAN if data is empty

Examples
use statrs::statistics::Median;
use statrs::statistics::Data;

let x = [];
let x = Data::new(x);
assert!(x.median().is_nan());

let y = [0.0, 3.0, -2.0];
let y = Data::new(y);
assert_eq!(y.median(), 0.0);

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);
Returns the order statistic (order 1..N) from the data Read more
Returns the median value from the data Read more
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
Estimates the p-Percentile value from the data. Read more
Estimates the first quartile value from the data. Read more
Estimates the third quartile value from the data. Read more
Estimates the inter-quartile range from the data. Read more
Evaluates the rank of each entry of the data. Read more
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self
The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Checks if self is actually part of its subset T (and can be converted to it).
Use with care! Same as self.to_subset but without any property checks. Always succeeds.
The inclusion map: converts self to the equivalent element of its superset.
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.