Zephyr Scientific Library (zscilib)
Data Structures | Functions
statistics.h File Reference

API header file for statistics in zscilib. More...

#include <zsl/zsl.h>
#include <zsl/vectors.h>
#include <zsl/matrices.h>

Go to the source code of this file.

Data Structures

struct  zsl_sta_linreg
 Simple linear regression coefficients. More...
 

Functions

int zsl_sta_mean (struct zsl_vec *v, zsl_real_t *m)
 Computes the arithmetic mean (average) of a vector. More...
 
int zsl_sta_trim_mean (struct zsl_vec *v, zsl_real_t p, zsl_real_t *m)
 Computes the trimmed arithmetic mean (average) of a vector. More...
 
int zsl_sta_weighted_mean (struct zsl_vec *v, struct zsl_vec *w, zsl_real_t *m)
 Computes the weighted arithmetic mean (average) of a data vector (v) and a weight vector (w). More...
 
int zsl_sta_time_weighted_mean (struct zsl_vec *v, struct zsl_vec *t, zsl_real_t *m)
 Computes the time-weighted arithmetic mean (average) of a positive data vector (v) and its time vector (w). More...
 
int zsl_sta_demean (struct zsl_vec *v, struct zsl_vec *w)
 Subtracts the mean of vector v from every component of the vector. The output vector w then has a zero mean. More...
 
int zsl_sta_percentile (struct zsl_vec *v, zsl_real_t p, zsl_real_t *val)
 Computes the given percentile of a vector. More...
 
int zsl_sta_median (struct zsl_vec *v, zsl_real_t *m)
 Computes the median of a vector (the value separating the higher half from the lower half of a data sample). More...
 
int zsl_sta_weighted_median (struct zsl_vec *v, struct zsl_vec *w, zsl_real_t *m)
 Computes the weighted median of a data vector (v) and a weight vector (w). More...
 
int zsl_sta_quart (struct zsl_vec *v, zsl_real_t *q1, zsl_real_t *q2, zsl_real_t *q3)
 Calculates the first, second and third quartiles of a vector v. More...
 
int zsl_sta_quart_range (struct zsl_vec *v, zsl_real_t *r)
 Calculates the numeric difference between the third and the first quartiles of a vector v. More...
 
int zsl_sta_mode (struct zsl_vec *v, struct zsl_vec *w)
 Computes the mode or modes of a vector v. More...
 
int zsl_sta_data_range (struct zsl_vec *v, zsl_real_t *r)
 Computes the difference between the greatest value and the lowest in a vector v. More...
 
int zsl_sta_mean_abs_dev (struct zsl_vec *v, zsl_real_t *m)
 Computes the mean absolute deviation of a data vector v. More...
 
int zsl_sta_median_abs_dev (struct zsl_vec *v, zsl_real_t *m)
 Computes the median absolute deviation of a data vector v. More...
 
int zsl_sta_var (struct zsl_vec *v, zsl_real_t *var)
 Computes the variance of a vector v (the average of the squared differences from the mean). More...
 
int zsl_sta_std_dev (struct zsl_vec *v, zsl_real_t *s)
 Computes the standard deviation of vector v. More...
 
int zsl_sta_covar (struct zsl_vec *v, struct zsl_vec *w, zsl_real_t *c)
 Computes the variance of two sets of data: v and w. More...
 
int zsl_sta_covar_mtx (struct zsl_mtx *m, struct zsl_mtx *mc)
 Calculates the nxn covariance matrix of a set of n vectors of the same length. More...
 
int zsl_sta_linear_reg (struct zsl_vec *x, struct zsl_vec *y, struct zsl_sta_linreg *c)
 Calculates the slope, intercept and correlation coefficient of the linear regression of two vectors, allowing us to make a prediction of y on the basis of x. More...
 
int zsl_sta_mult_linear_reg (struct zsl_mtx *x, struct zsl_vec *y, struct zsl_vec *b, zsl_real_t *r)
 Calculates the coefficients (vector 'b') of the multiple linear regression of the x_i values (columns of the matrix 'x') and the y values. More...
 
int zsl_sta_weighted_mult_linear_reg (struct zsl_mtx *x, struct zsl_vec *y, struct zsl_vec *w, struct zsl_vec *b, zsl_real_t *r)
 Calculates the coefficients (vector 'b') of the weighted multiple linear regression of the x_i values (columns of the matrix 'x'), the y values and the weights in the vector 'w'. More...
 
int zsl_sta_quad_fit (struct zsl_mtx *m, struct zsl_vec *b)
 This function uses the least squares fitting method to compute the coefficients of a quadric surface given a set of tridimensional points. More...
 
int zsl_sta_abs_err (zsl_real_t *val, zsl_real_t *exp_val, zsl_real_t *err)
 Calculates the absolute error given a value and its expected value. More...
 
int zsl_sta_rel_err (zsl_real_t *val, zsl_real_t *exp_val, zsl_real_t *err)
 Calculates the relative error given a value and its expected value. More...
 
int zsl_sta_sta_err (struct zsl_vec *v, zsl_real_t *err)
 Calculates the standard error of the mean of a sample (vector v). More...
 

Detailed Description

API header file for statistics in zscilib.

This file contains the zscilib statistics APIs

Definition in file statistics.h.