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

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

Statistics Trait

It contains mean, var, sd, cov

Associated Types

Loading content...

Required methods

pub fn mean(&self) -> Self::Value[src]

pub fn var(&self) -> Self::Value[src]

pub fn sd(&self) -> Self::Value[src]

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

pub fn cor(&self) -> Self::Array[src]

Loading content...

Implementations on Foreign Types

impl Statistics for Vec<f64>[src]

type Array = Vec<f64>

type Value = f64

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

Mean

Examples

#[macro_use]
extern crate peroxide;
use peroxide::fuga::*;

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

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

Variance

Examples

#[macro_use]
extern crate peroxide;
use peroxide::fuga::*;

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

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

Standard Deviation

Examples

#[macro_use]
extern crate peroxide;
use peroxide::fuga::*;

fn main() {
    let a = c!(1,2,3);
    assert!(nearly_eq(a.sd(), 1f64)); // Floating Number Error
}
Loading content...

Implementors

impl Statistics for Matrix[src]

type Array = Matrix

type Value = Vec<f64>

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

Column Mean

Examples

#[macro_use]
extern crate peroxide;
use peroxide::fuga::*;

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

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

Column variance

Examples

#[macro_use]
extern crate peroxide;
use peroxide::fuga::*;

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

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

Column Standard Deviation

Examples

#[macro_use]
extern crate peroxide;
use peroxide::fuga::*;

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

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

Covariance Matrix (Column based)

Examples

#[macro_use]
extern crate peroxide;
use peroxide::fuga::*;

fn main() {
    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<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...