Trait Stats
pub trait Stats {
Show 26 methods
// Required methods
fn vmag(self) -> f64;
fn vmagsq(self) -> f64;
fn vreciprocal(self) -> Result<Vec<f64>, RError<String>>;
fn vinverse(self) -> Result<Vec<f64>, RError<String>>;
fn negv(self) -> Result<Vec<f64>, RError<String>>;
fn vunit(self) -> Result<Vec<f64>, RError<String>>;
fn hmad(self) -> Result<f64, RError<String>>;
fn amean(self) -> Result<f64, RError<String>>;
fn medmad(self) -> Result<Params, RError<String>>;
fn ameanstd(self) -> Result<Params, RError<String>>;
fn awmean(self) -> Result<f64, RError<String>>;
fn awmeanstd(self) -> Result<Params, RError<String>>;
fn hmean(self) -> Result<f64, RError<String>>;
fn hmeanstd(self) -> Result<Params, RError<String>>;
fn hwmean(self) -> Result<f64, RError<String>>;
fn hwmeanstd(self) -> Result<Params, RError<String>>;
fn gmean(self) -> Result<f64, RError<String>>;
fn gmeanstd(self) -> Result<Params, RError<String>>;
fn gwmean(self) -> Result<f64, RError<String>>;
fn gwmeanstd(self) -> Result<Params, RError<String>>;
fn pdf(self) -> Vec<f64>;
fn entropy(self) -> f64;
fn autocorr(self) -> Result<f64, RError<String>>;
fn lintrans(self) -> Result<Vec<f64>, RError<String>>;
fn dfdt(self, centre: f64) -> Result<f64, RError<String>>;
fn house_reflector(self) -> Vec<f64>;
}
Expand description
Statistical measures of a single variable (one generic vector of data) and vector algebra applicable to a single (generic) vector. Thus these methods take no arguments.
Required Methods§
fn vreciprocal(self) -> Result<Vec<f64>, RError<String>>
fn vreciprocal(self) -> Result<Vec<f64>, RError<String>>
vector with reciprocal components
fn hmeanstd(self) -> Result<Params, RError<String>>
fn hmeanstd(self) -> Result<Params, RError<String>>
Harmonic mean and experimental standard deviation
fn gwmeanstd(self) -> Result<Params, RError<String>>
fn gwmeanstd(self) -> Result<Params, RError<String>>
Weighted geometric mean and standard deviation ratio
fn autocorr(self) -> Result<f64, RError<String>>
fn autocorr(self) -> Result<f64, RError<String>>
(Auto)correlation coefficient of pairs of successive values of (time series) variable.
fn dfdt(self, centre: f64) -> Result<f64, RError<String>>
fn dfdt(self, centre: f64) -> Result<f64, RError<String>>
Linearly weighted approximate time series derivative at the last (present time) point.
fn house_reflector(self) -> Vec<f64>
fn house_reflector(self) -> Vec<f64>
Householder reflection
Implementations on Foreign Types§
§impl<T> Stats for &[T]
impl<T> Stats for &[T]
§fn amean(self) -> Result<f64, RError<String>>
fn amean(self) -> Result<f64, RError<String>>
Arithmetic mean
§Example
use rstats::Stats;
let v1 = vec![1_f64,2.,3.,4.,5.,6.,7.,8.,9.,10.,11.,12.,13.,14.];
assert_eq!(v1.amean().unwrap(),7.5_f64);
§fn ameanstd(self) -> Result<Params, RError<String>>
fn ameanstd(self) -> Result<Params, RError<String>>
Arithmetic mean and (population) standard deviation
§Example
use rstats::Stats;
let v1 = vec![1_f64,2.,3.,4.,5.,6.,7.,8.,9.,10.,11.,12.,13.,14.];
let res = v1.ameanstd().unwrap();
assert_eq!(res.centre,7.5_f64);
assert_eq!(res.spread,4.031128874149275_f64);
§fn awmean(self) -> Result<f64, RError<String>>
fn awmean(self) -> Result<f64, RError<String>>
Linearly weighted arithmetic mean of an f64 slice.
Linearly ascending weights from 1 to n.
Time dependent data should be in the order of time increasing.
Then the most recent gets the most weight.
§Example
use rstats::Stats;
let v1 = vec![1_f64,2.,3.,4.,5.,6.,7.,8.,9.,10.,11.,12.,13.,14.];
assert_eq!(v1.awmean().unwrap(),9.666666666666666_f64);
§fn awmeanstd(self) -> Result<Params, RError<String>>
fn awmeanstd(self) -> Result<Params, RError<String>>
Linearly weighted arithmetic mean and standard deviation of an f64 slice.
Linearly ascending weights from 1 to n.
Time dependent data should be in the order of time increasing.
§Example
use rstats::Stats;
let v1 = vec![1_f64,2.,3.,4.,5.,6.,7.,8.,9.,10.,11.,12.,13.,14.];
let res = v1.awmeanstd().unwrap();
assert_eq!(res.centre,9.666666666666666_f64);
assert_eq!(res.spread,3.399346342395192_f64);
§fn hmean(self) -> Result<f64, RError<String>>
fn hmean(self) -> Result<f64, RError<String>>
Harmonic mean of an f64 slice.
§Example
use rstats::Stats;
let v1 = vec![1_f64,2.,3.,4.,5.,6.,7.,8.,9.,10.,11.,12.,13.,14.];
assert_eq!(v1.hmean().unwrap(),4.305622526633627_f64);
§fn hmeanstd(self) -> Result<Params, RError<String>>
fn hmeanstd(self) -> Result<Params, RError<String>>
Harmonic mean and standard deviation std is based on reciprocal moments
§Example
use rstats::Stats;
let v1 = vec![1_f64,2.,3.,4.,5.,6.,7.,8.,9.,10.,11.,12.,13.,14.];
let res = v1.hmeanstd().unwrap();
assert_eq!(res.centre,4.305622526633627_f64);
assert_eq!(res.spread,1.1996764516690959_f64);
§fn hwmean(self) -> Result<f64, RError<String>>
fn hwmean(self) -> Result<f64, RError<String>>
Linearly weighted harmonic mean of an f64 slice.
Linearly ascending weights from 1 to n.
Time dependent data should be ordered by increasing time.
§Example
use rstats::Stats;
let v1 = vec![1_f64,2.,3.,4.,5.,6.,7.,8.,9.,10.,11.,12.,13.,14.];
assert_eq!(v1.hwmean().unwrap(),7.5_f64);
§fn hwmeanstd(self) -> Result<Params, RError<String>>
fn hwmeanstd(self) -> Result<Params, RError<String>>
Weighted harmonic mean and standard deviation std is based on reciprocal moments
§Example
use rstats::Stats;
let v1 = vec![1_f64,2.,3.,4.,5.,6.,7.,8.,9.,10.,11.,12.,13.,14.];
let res = v1.hmeanstd().unwrap();
assert_eq!(res.centre,4.305622526633627_f64);
assert_eq!(res.spread,1.1996764516690959_f64);
§fn gmean(self) -> Result<f64, RError<String>>
fn gmean(self) -> Result<f64, RError<String>>
Geometric mean of an i64 slice.
The geometric mean is just an exponential of an arithmetic mean
of log data (natural logarithms of the data items).
The geometric mean is less sensitive to outliers near maximal value.
Zero valued data is not allowed!
§Example
use rstats::Stats;
let v1 = vec![1_f64,2.,3.,4.,5.,6.,7.,8.,9.,10.,11.,12.,13.,14.];
assert_eq!(v1.gmean().unwrap(),6.045855171418503_f64);
§fn gmeanstd(self) -> Result<Params, RError<String>>
fn gmeanstd(self) -> Result<Params, RError<String>>
Geometric mean and std ratio of an f64 slice.
Zero valued data is not allowed.
Std of ln data becomes a ratio after conversion back.
§Example
use rstats::Stats;
let v1 = vec![1_f64,2.,3.,4.,5.,6.,7.,8.,9.,10.,11.,12.,13.,14.];
let res = v1.gmeanstd().unwrap();
assert_eq!(res.centre,6.045855171418503_f64);
assert_eq!(res.spread,2.1084348239406303_f64);
§fn gwmean(self) -> Result<f64, RError<String>>
fn gwmean(self) -> Result<f64, RError<String>>
Linearly weighted geometric mean of an i64 slice.
Ascending weights from 1 down to n.
Time dependent data should be in time increasing order.
The geometric mean is an exponential of an arithmetic mean
of log data (natural logarithms of the data items).
The geometric mean is less sensitive to outliers near maximal value.
Zero valued data is not allowed!
§Example
use rstats::Stats;
let v1 = vec![1_f64,2.,3.,4.,5.,6.,7.,8.,9.,10.,11.,12.,13.,14.];
assert_eq!(v1.gwmean().unwrap(),8.8185222496341_f64);
§fn gwmeanstd(self) -> Result<Params, RError<String>>
fn gwmeanstd(self) -> Result<Params, RError<String>>
Linearly weighted version of gmeanstd.
§Example
use rstats::Stats;
let v1 = vec![1_f64,2.,3.,4.,5.,6.,7.,8.,9.,10.,11.,12.,13.,14.];
let res = v1.gwmeanstd().unwrap();
assert_eq!(res.centre,8.8185222496341_f64);
assert_eq!(res.spread,1.626825493266009_f64);
§fn pdf(self) -> Vec<f64>
fn pdf(self) -> Vec<f64>
Probability density function of a sorted slice with repeats. Repeats are counted and removed
§fn autocorr(self) -> Result<f64, RError<String>>
fn autocorr(self) -> Result<f64, RError<String>>
(Auto)correlation coefficient of pairs of successive values of (time series) f64 variable.
§Example
use rstats::Stats;
let v1 = vec![1_f64,2.,3.,4.,5.,6.,7.,8.,9.,10.,11.,12.,13.,14.];
assert_eq!(v1.autocorr().unwrap(),0.9984603532054123_f64);
§fn dfdt(self, centre: f64) -> Result<f64, RError<String>>
fn dfdt(self, centre: f64) -> Result<f64, RError<String>>
Linearly weighted approximate time series derivative at the last point (present time). Weighted sum (backwards half filter), minus the median. Rising values return positive result and vice versa.
§fn house_reflector(self) -> Vec<f64>
fn house_reflector(self) -> Vec<f64>
Householder reflector