stats::nan
NaN-aware statistics: the same as the plain ones on the values that
are not NaN (NumPy's nanmean, ...). Infinities are kept.
Functions
countSource
pub fn count<X: Sample>(x: X) -> usize The number of values that are not NaN.
nabi
assert(stats::nan::count([1.0, f64::NAN, 3.0]) == 2);
sumSource
pub fn sum<X: Sample>(x: X) -> f64 The sum of the values that are not NaN (0 when there are none).
nabi
assert(stats::nan::sum([1.0, f64::NAN, 2.0]) == 3.0);
meanSource
pub fn mean<X: Sample>(x: X) -> f64 The mean of the values that are not NaN; NaN when there are none.
nabi
assert(stats::nan::mean([1.0, f64::NAN, 3.0]) == 2.0);
varSource
pub fn var<X: Sample>(x: X, ddof: usize = 0) -> f64 The variance of the values that are not NaN.
nabi
assert(stats::nan::var([1.0, f64::NAN, 3.0]) == 1.0);
stdSource
pub fn std<X: Sample>(x: X, ddof: usize = 0) -> f64 The standard deviation of the values that are not NaN.
nabi
assert(stats::nan::std([1.0, f64::NAN, 3.0], ddof: 1) == 2.0.sqrt());
medianSource
pub fn median<X: Sample>(x: X) -> f64 The median of the values that are not NaN.
nabi
assert(stats::nan::median([f64::NAN, 4.0, 1.0, 2.0]) == 2.0);
quantileSource
pub fn quantile<X: Sample>(x: X, q: f64, method: QuantileMethod = QuantileMethod::Linear) throws (StatsError) -> f64 The q-quantile of the values that are not NaN.
nabi
assert(try stats::nan::quantile([f64::NAN, 1.0, 2.0, 3.0], 0.5) == 2.0);
minSource
pub fn min<X: Sample>(x: X) -> f64 The smallest value that is not NaN.
nabi
assert(stats::nan::min([f64::NAN, 4.0, 1.0]) == 1.0);
maxSource
pub fn max<X: Sample>(x: X) -> f64 The largest value that is not NaN.
nabi
assert(stats::nan::max([f64::NAN, 4.0, 1.0]) == 4.0);