Trait peroxide::statistics::stat::Statistics
source · [−]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;
}
Expand description
Statistics Trait
It contains mean
, var
, sd
, cov
Associated Types
Required methods
Implementations on Foreign Types
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);
}
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);
}
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
}