[][src]Trait peroxide::statistics::stat::Statistics

pub trait Statistics {
    type Array;
    type Value;
    fn mean(&self) -> Self::Value;
fn var(&self) -> Self::Value;
fn sd(&self) -> Self::Value;
fn cov(&self) -> Self::Array;
fn cor(&self) -> Self::Array; }

Statistics Trait

It contains mean, var, sd, cov

Associated Types

type Array

type Value

Loading content...

Required methods

fn mean(&self) -> Self::Value

fn var(&self) -> Self::Value

fn sd(&self) -> Self::Value

fn cov(&self) -> Self::Array

fn cor(&self) -> Self::Array

Loading content...

Implementors

impl Statistics for Matrix[src]

type Array = Matrix

type Value = Vector

fn mean(&self) -> Vector[src]

Column Mean

Examples

extern crate peroxide;
use peroxide::*;

let m = matrix(c!(1,3,3,1), 2, 2, Col);
assert_eq!(m.mean(), c!(2,2));

fn var(&self) -> Vector[src]

Column variance

Examples

extern crate peroxide;
use peroxide::*;

let m = matrix(c!(1,2,3,3,2,1), 3, 2, Col);
assert!(nearly_eq(m.var()[0], 1));

fn sd(&self) -> Vector[src]

Column Standard Deviation

Examples

extern crate peroxide;
use peroxide::*;

let m = matrix(c!(1,2,3,3,2,1), 3, 2, Col);
assert!(nearly_eq(m.sd()[0], 1));

fn cov(&self) -> Self[src]

Covariance Matrix (Column based)

Examples

extern crate peroxide;
use peroxide::*;

let m = matrix(c!(1,2,3,3,2,1), 3, 2, Col);
println!("{}", m.cov());

//         c[0]    c[1]
// r[0]  1.0000 -1.0000
// r[1] -1.0000  1.0000

impl Statistics for Vector[src]

type Array = Vector

type Value = f64

fn mean(&self) -> f64[src]

Mean

Examples

extern crate peroxide;
use peroxide::*;

let a = c!(1,2,3,4,5);
assert_eq!(a.mean(), 3.0);

fn var(&self) -> f64[src]

Variance

Examples

extern crate peroxide;
use peroxide::*;

let a = c!(1,2,3,4,5);
assert_eq!(a.var(), 2.5);

fn sd(&self) -> f64[src]

Standard Deviation

Examples

extern crate peroxide;
use peroxide::*;

let a = c!(1,2,3);
assert!(nearly_eq(a.sd(), 1f64)); // Floating Number Error

impl<T: PartialOrd + SampleUniform + Copy + Into<f64>> Statistics for OPDist<T>[src]

type Array = Vec<f64>

type Value = f64

impl<T: PartialOrd + SampleUniform + Copy + Into<f64>> Statistics for TPDist<T>[src]

type Array = Vec<f64>

type Value = f64

Loading content...