Trait rstats::Stats[][src]

pub trait Stats {
Show methods fn amean(self) -> Result<f64>
    where
        Self: Sized
, { ... }
fn ameanstd(self) -> Result<MStats>
    where
        Self: Sized
, { ... }
fn awmean(self) -> Result<f64>
    where
        Self: Sized
, { ... }
fn awmeanstd(self) -> Result<MStats>
    where
        Self: Sized
, { ... }
fn hmean(self) -> Result<f64>
    where
        Self: Sized
, { ... }
fn hwmean(self) -> Result<f64>
    where
        Self: Sized
, { ... }
fn gmean(self) -> Result<f64>
    where
        Self: Sized
, { ... }
fn gmeanstd(self) -> Result<MStats>
    where
        Self: Sized
, { ... }
fn gwmean(self) -> Result<f64>
    where
        Self: Sized
, { ... }
fn gwmeanstd(self) -> Result<MStats>
    where
        Self: Sized
, { ... }
fn median(self) -> Result<Med>
    where
        Self: Sized
, { ... }
fn ranks(self) -> Result<Vec<f64>>
    where
        Self: Sized
, { ... }
fn iranks(self) -> Result<Vec<i64>>
    where
        Self: Sized
, { ... }
}

Basic one dimensional (1-d) statistical measures. These methods operate on just one vector (of data) and take no arguments.

Provided methods

fn amean(self) -> Result<f64> where
    Self: Sized
[src]

Arithmetic mean

fn ameanstd(self) -> Result<MStats> where
    Self: Sized
[src]

Arithmetic mean and standard deviation

fn awmean(self) -> Result<f64> where
    Self: Sized
[src]

Weighted arithmetic mean

fn awmeanstd(self) -> Result<MStats> where
    Self: Sized
[src]

Weighted arithmetic men and standard deviation

fn hmean(self) -> Result<f64> where
    Self: Sized
[src]

Harmonic mean

fn hwmean(self) -> Result<f64> where
    Self: Sized
[src]

Weighted harmonic mean

fn gmean(self) -> Result<f64> where
    Self: Sized
[src]

Geometric mean

fn gmeanstd(self) -> Result<MStats> where
    Self: Sized
[src]

Geometric mean and standard deviation ratio

fn gwmean(self) -> Result<f64> where
    Self: Sized
[src]

Weighed geometric mean

fn gwmeanstd(self) -> Result<MStats> where
    Self: Sized
[src]

Weighted geometric mean and standard deviation ratio

fn median(self) -> Result<Med> where
    Self: Sized
[src]

Median and quartiles

fn ranks(self) -> Result<Vec<f64>> where
    Self: Sized
[src]

Creates vector of ranks for values in self

fn iranks(self) -> Result<Vec<i64>> where
    Self: Sized
[src]

Creates vector of integer ranks for values in self

Loading content...

Implementations on Foreign Types

impl Stats for &[f64][src]

fn amean(self) -> Result<f64>[src]

Arithmetic 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.as_slice().amean().unwrap(),7.5_f64);

fn ameanstd(self) -> Result<MStats>[src]

Arithmetic mean and (population) standard deviation 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.];
let res = v1.as_slice().ameanstd().unwrap();
assert_eq!(res.mean,7.5_f64);
assert_eq!(res.std,4.031128874149275_f64);

fn awmean(self) -> Result<f64>[src]

Linearly weighted arithmetic mean of an f64 slice.
Linearly descending weights from n down to one.
Time dependent data should be in the stack order - the last being the oldest.

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.as_slice().awmean().unwrap(),5.333333333333333_f64);

fn awmeanstd(self) -> Result<MStats>[src]

Liearly weighted arithmetic mean and standard deviation of an f64 slice.
Linearly descending weights from n down to one.
Time dependent data should be in the stack order - the last being the oldest.

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.as_slice().awmeanstd().unwrap();
assert_eq!(res.mean,5.333333333333333_f64);
assert_eq!(res.std,3.39934634239519_f64);

fn hmean(self) -> Result<f64>[src]

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.as_slice().hmean().unwrap(),4.305622526633627_f64);

fn hwmean(self) -> Result<f64>[src]

Linearly weighted harmonic mean of an f64 slice.
Linearly descending weights from n down to one.
Time dependent data should be in the stack order - the last being the oldest.

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.as_slice().hwmean().unwrap(),3.019546395306663_f64);

fn gmean(self) -> Result<f64>[src]

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.as_slice().gmean().unwrap(),6.045855171418503_f64);

fn gwmean(self) -> Result<f64>[src]

Linearly weighted geometric mean of an i64 slice.
Descending weights from n down to one.
Time dependent data should be in the stack order - the last being the oldest.
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 data is not allowed - would at best only produce zero result.

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.as_slice().gwmean().unwrap(),4.144953510241978_f64);

fn gmeanstd(self) -> Result<MStats>[src]

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.as_slice().gmeanstd().unwrap();
assert_eq!(res.mean,6.045855171418503_f64);
assert_eq!(res.std,2.1084348239406303_f64);

fn gwmeanstd(self) -> Result<MStats>[src]

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.as_slice().gwmeanstd().unwrap();
assert_eq!(res.mean,4.144953510241978_f64);
assert_eq!(res.std,2.1572089236412597_f64);

fn median(self) -> Result<Med>[src]

Median 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.];
let res = v1.as_slice().median().unwrap();
assert_eq!(res.median,7.5_f64);
assert_eq!(res.lquartile,4.25_f64);
assert_eq!(res.uquartile,10.75_f64);

fn ranks(self) -> Result<Vec<f64>>[src]

Returns vector of f64 ranks; ranked from the smallest number in self (rank 0) to the biggest (rank n-1). Equalities lead to fractional ranks, hence Vec output and the range of rank values is reduced. Has complexity n*(n-1)/2. Use mergerank for long lists.

fn iranks(self) -> Result<Vec<i64>>[src]

Returns vector of i64 ranks; ranked from the smallest number in self (rank 0) to the biggest (rank n-1).

impl Stats for &[i64][src]

fn amean(self) -> Result<f64>[src]

Arithmetic mean of an i64 slice

Example

use rstats::Stats;
let v1:Vec<i64> = vec![1,2,3,4,5,6,7,8,9,10,11,12,13,14];
assert_eq!(v1.as_slice().amean().unwrap(),7.5_f64);

fn ameanstd(self) -> Result<MStats>[src]

Arithmetic mean and standard deviation of an i64 slice

Example

use rstats::Stats;
let v1 = vec![1_i64,2,3,4,5,6,7,8,9,10,11,12,13,14];
let res = v1.as_slice().ameanstd().unwrap();
assert_eq!(res.mean,7.5_f64);
assert_eq!(res.std,4.031128874149275_f64);

fn awmean(self) -> Result<f64>[src]

Linearly weighted arithmetic mean of an i64 slice.
Linearly descending weights from n down to one.
Time dependent data should be in the stack order - the last being the oldest.

Example

use rstats::Stats;
let v1 = vec![1_i64,2,3,4,5,6,7,8,9,10,11,12,13,14];
assert_eq!(v1.as_slice().awmean().unwrap(),5.333333333333333_f64);

fn awmeanstd(self) -> Result<MStats>[src]

Liearly weighted arithmetic mean and standard deviation of an i64 slice.
Linearly descending weights from n down to one.
Time dependent data should be in the stack order - the last being the oldest.

Example

use rstats::Stats;
let v1 = vec![1_i64,2,3,4,5,6,7,8,9,10,11,12,13,14];
let res = v1.as_slice().awmeanstd().unwrap();
assert_eq!(res.mean,5.333333333333333_f64);
assert_eq!(res.std,3.39934634239519_f64);

fn hmean(self) -> Result<f64>[src]

Harmonic mean of an i64 slice.

Example

use rstats::Stats;
let v1 = vec![1_i64,2,3,4,5,6,7,8,9,10,11,12,13,14];
assert_eq!(v1.as_slice().hmean().unwrap(),4.305622526633627_f64);

fn hwmean(self) -> Result<f64>[src]

Linearly weighted harmonic mean of an i64 slice.
Linearly descending weights from n down to one.
Time dependent data should be in the stack order - the last being the oldest.

Example

use rstats::Stats;
let v1 = vec![1_i64,2,3,4,5,6,7,8,9,10,11,12,13,14];
assert_eq!(v1.as_slice().hwmean().unwrap(),3.019546395306663_f64);

fn gmean(self) -> Result<f64>[src]

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_i64,2,3,4,5,6,7,8,9,10,11,12,13,14];
assert_eq!(v1.as_slice().gmean().unwrap(),6.045855171418503_f64);

fn gwmean(self) -> Result<f64>[src]

Linearly weighted geometric mean of an i64 slice.
Descending weights from n down to one.
Time dependent data should be in the stack order - the last being the oldest.
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 data is not allowed - would at best only produce zero result.

Example

use rstats::Stats;
let v1 = vec![1_i64,2,3,4,5,6,7,8,9,10,11,12,13,14];
assert_eq!(v1.as_slice().gwmean().unwrap(),4.144953510241978_f64);

fn gmeanstd(self) -> Result<MStats>[src]

Geometric mean and std ratio of an i64 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_i64,2,3,4,5,6,7,8,9,10,11,12,13,14];
let res = v1.as_slice().gmeanstd().unwrap();
assert_eq!(res.mean,6.045855171418503_f64);
assert_eq!(res.std,2.1084348239406303_f64);

fn gwmeanstd(self) -> Result<MStats>[src]

Linearly weighted version of gmeanstd.

Example

use rstats::Stats;
let v1 = vec![1_i64,2,3,4,5,6,7,8,9,10,11,12,13,14];
let res = v1.as_slice().gwmeanstd().unwrap();
assert_eq!(res.mean,4.144953510241978_f64);
assert_eq!(res.std,2.1572089236412597_f64);

fn median(self) -> Result<Med>[src]

Median.

Example

use rstats::Stats;
let v1 = vec![1_i64,2,3,4,5,6,7,8,9,10,11,12,13,14,15];
let res = v1.as_slice().median().unwrap();
assert_eq!(res.median,8.);
assert_eq!(res.lquartile,4.5);
assert_eq!(res.uquartile,11.5);

fn ranks(self) -> Result<Vec<f64>>[src]

Returns vector of ranks, ranked from the smallest number in self (rank 0) to the biggest (rank n-1). Equalities lead to fractional ranks (hence Vec output) and the range of rank values is reduced.

fn iranks(self) -> Result<Vec<i64>>[src]

Returns vector of ranks, ranked from the smallest number in self (rank 0) to the biggest (rank n-1).

Loading content...

Implementors

Loading content...