Crate rstats

source ·
Expand description

Statistics, Linear Algebra, Information Measures, Cholesky Matrix Decomposition, Mahalanobis Distance, Multidimensional Data Analysis, Machine Learning and more …

Re-exports

  • pub use crate::error::re_error;
  • pub use crate::error::RError;
  • pub use crate::error::RE;

Modules

  • Custom error RError
  • Vector algebra mutating an f64 vector
  • Basic statistics on a single generic vector
  • Associated functions implemented for struct TriangMat
  • Vector algebra on two generic vectors
  • Stats and vector algebra on one or two u8 vectors
  • Multidimensional operations on sets of vectors
  • Multidimensional operations on sets of vectors, with additional inputs

Structs

  • Holds measures of central tendency and spread. Usually some kind of mean and its associated standard deviation, or median and its MAD
  • struct for minimum value, its index, maximum value, its index
  • Compact Triangular Matrix. TriangMat is typically result of some matrix calculations, so concrete end-type f64 is used for simplicity and accuracy. Data is of length n*(n+1)/2 instead of n*n, saving memory.
    .kind == 0 is plain lower triangular matrix.
    .kind == 1 is antisymmetric square matrix.
    .kind == 2 is symmetric square matrix.
    .kind == 3 is upper triangular matrix (transposed lower).
    .kind == 4 is upper (transposed lower), antisymmetric.
    .kind == 5 is unnecessary, as transposed symmetric matrix is unchanged.
    Simply adding (or subtracting) 3 to .kind implicitly transposes the matrix. .kind > 2 are all transposed, individual variants are determined by kind % 3. The full size of the implied square matrix, nxn, is not explicitly stored. It is obtained by solving the quadratic equation: n^2+n-2s=0=>n=((((8 * s + 1) as f64).sqrt() - 1.) / 2.) as usize;where s =triangmat.len()=n*(n+1)/2`

Enums

Constants

  • When interpolated, makes following foreground rendering bold blue
  • When interpolated, makes following foreground rendering bold cyan
  • When interpolated, makes following foreground rendering bold green
  • When interpolated, makes following foreground rendering bold magenta
  • When interpolated, makes following foreground rendering bold red
  • Returns the terminal rendering to default
  • When interpolated, makes following foreground rendering bold yellow

Traits

  • Fast 1D generic medians and associated information and tasks.
    Using auto referencing to disambiguate conflicts with five more specific Medianf64 methods with the same names.
    To invoke specifically these generic versions, add a reference:
    (&v[..]).method or v.as_slice().method
  • Fast 1D f64 medians and associated information and tasks
  • Mutable operations on one generic slice. A few of the essential Vecg methods are reimplemented here to mutate self. This is for efficiency and convenience. For example, in vector iterative methods.
  • Trait to serialize tuples &(T,T) and &(T,T,T) and slices &[T], &[&[T]], &[Vec<T>]. Suitable for printing or writing to files pairs, triplets, all kinds of Vecs and slices and irregularly shaped 2D matrices.
    All are converted into Strings and optionally decorated and coloured. Included are methods and constants to render the resulting String in six primary bold ANSI terminal colours.
  • 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.
  • Methods applicable to a slice of vectors of generic end type. Operations on a whole set of multidimensional vectors.
  • Methods applicable to slice of vectors of generic end type, plus one other argument of a similar kind
  • Vector Algebra on two vectors (represented here as generic slices). Also included are scalar operations on the self vector.
  • Methods specialised to and more efficient, for &[u8]

Functions

  • Convenience From quantification invocation
  • Convenience dummy function for quantify closure
  • Sum of natural numbers 1..n. Also the size of an upper or lower triangle of a square array (including the diagonal) to exclude the diagonal, use sumn(n-1)
  • t_statistic in 1d: (value-centre)/dispersion generalized to any measure of central tendency and dispersion
  • Generates full nxn unit (identity) matrix