Struct criterion_stats::univariate::Sample
[−]
[src]
pub struct Sample<A>(_);
A collection of data points drawn from a population
Invariants:
- The sample contains at least 2 data points
- The sample contains no
NaN
s
Methods
impl<A> Sample<A>
[src]
fn as_slice(&self) -> &[A]
[src]
Returns a slice that contains all the data points
NOTE: This will be removed in favor of a Deref<Target=[A]>
implementation once
rust-lang/rust#22257 is fixed.
impl<A> Sample<A> where
A: Float,
[src]
A: Float,
fn new(slice: &[A]) -> &Sample<A>
[src]
Creates a new sample from an existing slice
Panics
Panics if slice
contains any NaN
or if slice
has less than two elements
fn max(&self) -> A
[src]
Returns the biggest element in the sample
- Time:
O(length)
fn mean(&self) -> A
[src]
Returns the arithmetic average of the sample
- Time:
O(length)
fn median_abs_dev(&self, median: Option<A>) -> A where
usize: From<A, Output = Result<usize, Error>>,
[src]
usize: From<A, Output = Result<usize, Error>>,
Returns the median absolute deviation
The median
can be optionally passed along to speed up (2X) the computation
- Time:
O(length)
- Memory:
O(length)
fn median_abs_dev_pct(&self) -> A where
usize: From<A, Output = Result<usize, Error>>,
[src]
usize: From<A, Output = Result<usize, Error>>,
Returns the median absolute deviation as a percentage of the median
- Time:
O(length)
- Memory:
O(length)
fn min(&self) -> A
[src]
Returns the smallest element in the sample
- Time:
O(length)
fn percentiles(&self) -> Percentiles<A> where
usize: From<A, Output = Result<usize, Error>>,
[src]
usize: From<A, Output = Result<usize, Error>>,
Returns a "view" into the percentiles of the sample
This "view" makes consecutive computations of percentiles much faster (O(1)
)
- Time:
O(N log N) where N = length
- Memory:
O(length)
fn std_dev(&self, mean: Option<A>) -> A
[src]
Returns the standard deviation of the sample
The mean
can be optionally passed along to speed up (2X) the computation
- Time:
O(length)
fn std_dev_pct(&self) -> A
[src]
Returns the standard deviation as a percentage of the mean
- Time:
O(length)
fn sum(&self) -> A
[src]
Returns the sum of all the elements of the sample
- Time:
O(length)
fn t(&self, other: &Sample<A>) -> A
[src]
Returns the t score between these two samples
- Time:
O(length)
fn var(&self, mean: Option<A>) -> A
[src]
Returns the variance of the sample
The mean
can be optionally passed along to speed up (2X) the computation
- Time:
O(length)
fn bootstrap<T, S>(&self, nresamples: usize, statistic: S) -> T::Distributions where
S: Fn(&Sample<A>) -> T,
S: Sync,
T: Tuple,
T: Send,
T::Distributions: Send,
T::Builder: Send,
[src]
S: Fn(&Sample<A>) -> T,
S: Sync,
T: Tuple,
T: Send,
T::Distributions: Send,
T::Builder: Send,
Returns the bootstrap distributions of the parameters estimated by the 1-sample statistic
- Multi-threaded
- Time:
O(nresamples)
- Memory:
O(nresamples)