Namespaces
vec_stats.h File Reference

Statistical functions for vector types. More...

#include <o2scl/err_hnd.h>
#include <o2scl/vector.h>

Go to the source code of this file.

Namespaces

 o2scl
 The main O2scl namespace.
 

Functions

Vector functions
template<class vec_t >
double o2scl::vector_mean (size_t n, const vec_t &data)
 Compute the mean of the first n elements of a vector. More...
 
template<class vec_t >
double o2scl::vector_mean (const vec_t &data)
 Compute the mean of all of the vector elements. More...
 
template<class vec_t >
double o2scl::vector_variance_fmean (size_t n, const vec_t &data, double mean)
 Compute variance with specified mean known in advance. More...
 
template<class vec_t >
double o2scl::vector_variance_fmean (const vec_t &data, double mean)
 Compute variance with specified mean known in advance. More...
 
template<class vec_t >
double o2scl::vector_variance (size_t n, const vec_t &data, double mean)
 Compute the variance with specified mean. More...
 
template<class vec_t >
double o2scl::vector_variance (const vec_t &data, double mean)
 Compute the variance with specified mean. More...
 
template<class vec_t >
double o2scl::vector_variance (size_t n, const vec_t &data)
 Compute the variance. More...
 
template<class vec_t >
double o2scl::vector_variance (const vec_t &data)
 Compute the variance. More...
 
template<class vec_t >
double o2scl::vector_stddev_fmean (size_t n, const vec_t &data, double mean)
 Standard deviation with specified mean known in advance. More...
 
template<class vec_t >
double o2scl::vector_stddev_fmean (const vec_t &data, double mean)
 Standard deviation with specified mean known in advance. More...
 
template<class vec_t >
double o2scl::vector_stddev (size_t n, const vec_t &data)
 Standard deviation with specified mean. More...
 
template<class vec_t >
double o2scl::vector_stddev (const vec_t &data)
 Standard deviation with specified mean. More...
 
template<class vec_t >
double o2scl::vector_stddev (size_t n, const vec_t &data, double mean)
 Standard deviation with specified mean. More...
 
template<class vec_t >
double o2scl::vector_stddev (const vec_t &data, double mean)
 Standard deviation with specified mean. More...
 
template<class vec_t >
double o2scl::vector_absdev (size_t n, const vec_t &data, double mean)
 Absolute deviation from the specified mean. More...
 
template<class vec_t >
double o2scl::vector_absdev (const vec_t &data, double mean)
 Absolute deviation from the specified mean. More...
 
template<class vec_t >
double o2scl::vector_absdev (size_t n, const vec_t &data)
 Absolute deviation from the computed mean. More...
 
template<class vec_t >
double o2scl::vector_absdev (const vec_t &data)
 Absolute deviation from the computed mean. More...
 
template<class vec_t >
double o2scl::vector_skew (size_t n, const vec_t &data, double mean, double stddev)
 Skewness with specified mean and standard deviation. More...
 
template<class vec_t >
double o2scl::vector_skew (const vec_t &data, double mean, double stddev)
 Skewness with specified mean and standard deviation. More...
 
template<class vec_t >
double o2scl::vector_skew (size_t n, const vec_t &data)
 Skewness with computed mean and standard deviation. More...
 
template<class vec_t >
double o2scl::vector_skew (const vec_t &data)
 Skewness with computed mean and standard deviation. More...
 
template<class vec_t >
double o2scl::vector_kurtosis (size_t n, const vec_t &data, double mean, double stddev)
 Kurtosis with specified mean and standard deviation. More...
 
template<class vec_t >
double o2scl::vector_kurtosis (const vec_t &data, double mean, double stddev)
 Kurtosis with specified mean and standard deviation. More...
 
template<class vec_t >
double o2scl::vector_kurtosis (size_t n, const vec_t &data)
 Kurtosis with computed mean and standard deviation. More...
 
template<class vec_t >
double o2scl::vector_kurtosis (const vec_t &data)
 Kurtosis with computed mean and standard deviation. More...
 
template<class vec_t >
double o2scl::vector_lag1_autocorr (size_t n, const vec_t &data, double mean)
 Lag-1 autocorrelation. More...
 
template<class vec_t >
double o2scl::vector_lag1_autocorr (const vec_t &data, double mean)
 Lag-1 autocorrelation. More...
 
template<class vec_t >
double o2scl::vector_lag1_autocorr (size_t n, const vec_t &data)
 Lag-1 autocorrelation. More...
 
template<class vec_t >
double o2scl::vector_lag1_autocorr (const vec_t &data)
 Lag-1 autocorrelation. More...
 
template<class vec_t >
double o2scl::vector_lagk_autocorr (size_t n, const vec_t &data, size_t k, double mean)
 Lag-k autocorrelation. More...
 
template<class vec_t >
double o2scl::vector_lagk_autocorr (const vec_t &data, size_t k, double mean)
 Lag-k autocorrelation. More...
 
template<class vec_t >
double o2scl::vector_lagk_autocorr (size_t n, const vec_t &data, size_t k)
 Lag-k autocorrelation. More...
 
template<class vec_t >
double o2scl::vector_lagk_autocorr (const vec_t &data, size_t k)
 Lag-k autocorrelation. More...
 
template<class vec_t , class vec2_t >
double o2scl::vector_covariance (size_t n, const vec_t &data1, const vec2_t &data2, double mean1, double mean2)
 Compute the covariance of two vectors. More...
 
template<class vec_t , class vec2_t >
double o2scl::vector_covariance (const vec_t &data1, const vec2_t &data2, double mean1, double mean2)
 Compute the covariance of two vectors. More...
 
template<class vec_t , class vec2_t >
double o2scl::vector_covariance (size_t n, const vec_t &data1, const vec2_t &data2)
 Compute the covariance of two vectors. More...
 
template<class vec_t , class vec2_t >
double o2scl::vector_covariance (const vec_t &data1, const vec2_t &data2)
 Compute the covariance of two vectors. More...
 
template<class vec_t , class vec2_t >
double o2scl::vector_correlation (size_t n, const vec_t &data1, const vec2_t &data2)
 Pearson's correlation. More...
 
template<class vec_t , class vec2_t >
double o2scl::vector_correlation (const vec_t &data1, const vec2_t &data2)
 Pearson's correlation. More...
 
template<class vec_t , class vec2_t >
double o2scl::vector_pvariance (size_t n1, const vec_t &data1, size_t n2, const vec2_t &data2)
 The pooled variance of two vectors. More...
 
template<class vec_t , class vec2_t >
double o2scl::vector_pvariance (const vec_t &data1, const vec2_t &data2)
 The pooled variance of two vectors. More...
 
template<class vec_t >
double o2scl::vector_quantile_sorted (size_t n, const vec_t &data, const double f)
 Quantile from sorted data (ascending only) More...
 
template<class vec_t >
double o2scl::vector_quantile_sorted (const vec_t &data, const double f)
 Quantile from sorted data (ascending only) More...
 
template<class vec_t >
double o2scl::vector_median_sorted (size_t n, const vec_t &data)
 Return the median of sorted (ascending or descending) data. More...
 
template<class vec_t >
double o2scl::vector_median_sorted (const vec_t &data)
 Return the median of sorted (ascending or descending) data. More...
 
template<class vec_t , class vec2_t , class vec3_t >
double o2scl::vector_chi_squared (size_t n, const vec_t &obs, const vec2_t &exp, const vec3_t &err)
 Compute the chi-squared statistic. More...
 
template<class vec_t , class vec2_t , class vec3_t >
double o2scl::vector_chi_squared (const vec_t &obs, const vec2_t &exp, const vec3_t &err)
 Compute the chi-squared statistic. More...
 
Weighted vector functions
template<class vec_t , class vec2_t >
double o2scl::wvector_mean (size_t n, const vec_t &data, const vec2_t &weights)
 Compute the mean of weighted data. More...
 
template<class vec_t , class vec2_t >
double o2scl::wvector_mean (const vec_t &data, const vec2_t &weights)
 Compute the mean of weighted data. More...
 
template<class vec_t >
double o2scl::wvector_factor (size_t n, const vec_t &weights)
 Compute a normalization factor for weighted data. More...
 
template<class vec_t >
double o2scl::wvector_factor (const vec_t &weights)
 Compute a normalization factor for weighted data. More...
 
template<class vec_t , class vec2_t >
double o2scl::wvector_variance_fmean (size_t n, const vec_t &data, const vec2_t &weights, double wmean)
 Compute the variance of a weighted vector with a mean known in advance. More...
 
template<class vec_t , class vec2_t >
double o2scl::wvector_variance_fmean (const vec_t &data, const vec2_t &weights, double wmean)
 Compute the variance of a weighted vector with a mean known in advance. More...
 
template<class vec_t , class vec2_t >
double o2scl::wvector_variance (size_t n, const vec_t &data, const vec2_t &weights, double wmean)
 Compute the variance of a weighted vector with specified mean. More...
 
template<class vec_t , class vec2_t >
double o2scl::wvector_variance (const vec_t &data, const vec2_t &weights, double wmean)
 Compute the variance of a weighted vector with specified mean. More...
 
template<class vec_t , class vec2_t >
double o2scl::wvector_variance (size_t n, const vec_t &data, const vec2_t &weights)
 Compute the variance of a weighted vector where mean is computed automatically. More...
 
template<class vec_t , class vec2_t >
double o2scl::wvector_variance (const vec_t &data, const vec2_t &weights)
 Compute the variance of a weighted vector where mean is computed automatically. More...
 
template<class vec_t , class vec2_t , class vec3_t >
double o2scl::wvector_covariance (size_t n, const vec_t &data1, const vec2_t &data2, const vec3_t &weights)
 The weighted covariance of two vectors. More...
 
template<class vec_t , class vec2_t , class vec3_t >
double o2scl::wvector_covariance (const vec_t &data1, const vec2_t &data2, const vec3_t &weights)
 The weighted covariance of two vectors. More...
 
template<class vec_t , class vec2_t >
double o2scl::wvector_stddev_fmean (size_t n, const vec_t &data, const vec2_t &weights, double wmean)
 Compute the standard deviation of a weighted vector with a mean known in advance. More...
 
template<class vec_t , class vec2_t >
double o2scl::wvector_stddev_fmean (const vec_t &data, const vec2_t &weights, double wmean)
 Compute the standard deviation of a weighted vector with a mean known in advance. More...
 
template<class vec_t , class vec2_t >
double o2scl::wvector_stddev (size_t n, const vec_t &data, const vec2_t &weights)
 Compute the standard deviation of a weighted vector where mean is computed automatically. More...
 
template<class vec_t , class vec2_t >
double o2scl::wvector_stddev (const vec_t &data, const vec2_t &weights)
 Compute the standard deviation of a weighted vector where mean is computed automatically. More...
 
template<class vec_t , class vec2_t >
double o2scl::wvector_stddev (size_t n, const vec_t &data, const vec2_t &weights, double wmean)
 Compute the standard deviation of a weighted vector with specified mean. More...
 
template<class vec_t , class vec2_t >
double o2scl::wvector_stddev (const vec_t &data, const vec2_t &weights, double wmean)
 Compute the standard deviation of a weighted vector with specified mean. More...
 
template<class vec_t , class vec2_t >
double o2scl::wvector_sumsq (size_t n, const vec_t &data, const vec2_t &weights, double wmean)
 Compute the weighted sum of squares of data about the specified weighted mean. More...
 
template<class vec_t , class vec2_t >
double o2scl::wvector_sumsq (const vec_t &data, const vec2_t &weights, double wmean)
 Compute the weighted sum of squares of data about the specified weighted mean. More...
 
template<class vec_t , class vec2_t >
double o2scl::wvector_sumsq (size_t n, const vec_t &data, const vec2_t &weights)
 Compute the weighted sum of squares of data about the weighted mean. More...
 
template<class vec_t , class vec2_t >
double o2scl::wvector_sumsq (const vec_t &data, const vec2_t &weights)
 Compute the weighted sum of squares of data about the weighted mean. More...
 
template<class vec_t , class vec2_t >
double o2scl::wvector_absdev (size_t n, const vec_t &data, const vec2_t &weights, double wmean)
 Compute the absolute deviation of data about a specified mean. More...
 
template<class vec_t , class vec2_t >
double o2scl::wvector_absdev (const vec_t &data, const vec2_t &weights, double wmean)
 Compute the absolute deviation of data about a specified mean. More...
 
template<class vec_t , class vec2_t >
double o2scl::wvector_absdev (size_t n, const vec_t &data, const vec2_t &weights)
 Compute the absolute deviation of data about a specified mean. More...
 
template<class vec_t , class vec2_t >
double o2scl::wvector_absdev (const vec_t &data, const vec2_t &weights)
 Compute the absolute deviation of data about a specified mean. More...
 
template<class vec_t , class vec2_t >
double o2scl::wvector_skew (size_t n, const vec_t &data, const vec2_t &weights, double wmean, double wsd)
 Compute the skewness of data with specified mean and standard deviation. More...
 
template<class vec_t , class vec2_t >
double o2scl::wvector_skew (const vec_t &data, const vec2_t &weights, double wmean, double wsd)
 Compute the skewness of data with specified mean and standard deviation. More...
 
template<class vec_t , class vec2_t >
double o2scl::wvector_skew (size_t n, const vec_t &data, const vec2_t &weights)
 Compute the skewness of data with specified mean and standard deviation. More...
 
template<class vec_t , class vec2_t >
double o2scl::wvector_skew (const vec_t &data, const vec2_t &weights)
 Compute the skewness of data with specified mean and standard deviation. More...
 
template<class vec_t , class vec2_t >
double o2scl::wvector_kurtosis (size_t n, const vec_t &data, const vec2_t &weights, double wmean, double wsd)
 Compute the kurtosis of data with specified mean and standard deviation. More...
 
template<class vec_t , class vec2_t >
double o2scl::wvector_kurtosis (const vec_t &data, const vec2_t &weights, double wmean, double wsd)
 Compute the kurtosis of data with specified mean and standard deviation. More...
 
template<class vec_t , class vec2_t >
double o2scl::wvector_kurtosis (size_t n, const vec_t &data, const vec2_t &weights)
 Compute the kurtosis of data with specified mean and standard deviation. More...
 
template<class vec_t , class vec2_t >
double o2scl::wvector_kurtosis (const vec_t &data, const vec2_t &weights)
 Compute the kurtosis of data with specified mean and standard deviation. More...
 

Detailed Description

This file contains several function templates for computing statistics of vectors of double-precision data. It includes mean, median, variance, standard deviation, covariance, correlation, and other functions.

No additional range checking is done on the vectors.

Idea for Future:
Consider generalizing to other data types.

Definition in file vec_stats.h.

Documentation generated with Doxygen. Provided under the GNU Free Documentation License (see License Information).