IT++ Logo
Classes | Functions
Miscellaneous Statistics Functions

Classes

class  itpp::Stat
 A class for sampling a signal and calculating statistics. More...
 

Functions

double itpp::mean (const vec &v)
 The mean value.
 
std::complex< doubleitpp::mean (const cvec &v)
 The mean value.
 
double itpp::mean (const svec &v)
 The mean value.
 
double itpp::mean (const ivec &v)
 The mean value.
 
double itpp::mean (const mat &m)
 The mean value.
 
std::complex< doubleitpp::mean (const cmat &m)
 The mean value.
 
double itpp::mean (const smat &m)
 The mean value.
 
double itpp::mean (const imat &m)
 The mean value.
 
template<class T >
double itpp::geometric_mean (const Vec< T > &v)
 The geometric mean of a vector.
 
template<class T >
double itpp::geometric_mean (const Mat< T > &m)
 The geometric mean of a matrix.
 
template<class T >
double itpp::median (const Vec< T > &v)
 The median.
 
double itpp::norm (const cvec &v)
 Calculate the 2-norm: norm(v)=sqrt(sum(abs(v).^2))
 
template<class T >
double itpp::norm (const Vec< T > &v)
 Calculate the 2-norm: norm(v)=sqrt(sum(abs(v).^2))
 
double itpp::norm (const cvec &v, int p)
 Calculate the p-norm: norm(v,p)=sum(abs(v).^2)^(1/p)
 
template<class T >
double itpp::norm (const Vec< T > &v, int p)
 Calculate the p-norm: norm(v,p)=sum(abs(v).^2)^(1/p)
 
double itpp::norm (const cvec &v, const std::string &s)
 Calculate the Frobenius norm for s = "fro" (equal to 2-norm)
 
template<class T >
double itpp::norm (const Vec< T > &v, const std::string &s)
 Calculate the Frobenius norm for s = "fro" (equal to 2-norm)
 
double itpp::norm (const mat &m, int p)
 
double itpp::norm (const cmat &m, int p)
 
double itpp::norm (const mat &m, const std::string &s)
 Calculate the Frobenius norm of a matrix for s = "fro".
 
double itpp::norm (const cmat &m, const std::string &s)
 Calculate the Frobenius norm of a matrix for s = "fro".
 
double itpp::variance (const cvec &v)
 The variance of the elements in the vector. Normalized with N-1 to be unbiased.
 
template<class T >
double itpp::variance (const Vec< T > &v)
 The variance of the elements in the vector. Normalized with N-1 to be unbiased.
 
template<class T >
double itpp::energy (const Vec< T > &v)
 Calculate the energy: squared 2-norm. energy(v)=sum(abs(v).^2)
 
bool itpp::within_tolerance (double x, double xref, double tol=1e-14)
 Return true if the input value x is within the tolerance tol of the reference value xref.
 
bool itpp::within_tolerance (std::complex< double > x, std::complex< double > xref, double tol=1e-14)
 Return true if the input value x is within the tolerance tol of the reference value xref.
 
bool itpp::within_tolerance (const vec &x, const vec &xref, double tol=1e-14)
 Return true if the input vector x is elementwise within the tolerance tol of the reference vector xref.
 
bool itpp::within_tolerance (const cvec &x, const cvec &xref, double tol=1e-14)
 Return true if the input vector x is elementwise within the tolerance tol of the reference vector xref.
 
bool itpp::within_tolerance (const mat &X, const mat &Xref, double tol=1e-14)
 Return true if the input matrix X is elementwise within the tolerance tol of the reference matrix Xref.
 
bool itpp::within_tolerance (const cmat &X, const cmat &Xref, double tol=1e-14)
 Return true if the input matrix X is elementwise within the tolerance tol of the reference matrix Xref.
 
double itpp::moment (const vec &x, const int r)
 Calculate the central moment of vector x.
 
double itpp::skewness (const vec &x)
 Calculate the skewness excess of the input vector x.
 
double itpp::kurtosisexcess (const vec &x)
 Calculate the kurtosis excess of the input vector x.
 
double itpp::kurtosis (const vec &x)
 Calculate the kurtosis of the input vector x.
 

Detailed Description

Function Documentation

◆ mean() [1/8]

ITPP_EXPORT double itpp::mean ( const vec &  v)

◆ mean() [2/8]

ITPP_EXPORT std::complex< double > itpp::mean ( const cvec &  v)

The mean value.

Definition at line 41 of file misc_stat.cpp.

References itpp::Array< T >::size(), and itpp::sum().

◆ mean() [3/8]

ITPP_EXPORT double itpp::mean ( const svec &  v)

The mean value.

Definition at line 46 of file misc_stat.cpp.

References itpp::Array< T >::length(), and itpp::sum().

◆ mean() [4/8]

ITPP_EXPORT double itpp::mean ( const ivec &  v)

The mean value.

Definition at line 51 of file misc_stat.cpp.

References itpp::Array< T >::length(), and itpp::sum().

◆ mean() [5/8]

ITPP_EXPORT double itpp::mean ( const mat &  m)

The mean value.

Definition at line 56 of file misc_stat.cpp.

References itpp::sum().

◆ mean() [6/8]

ITPP_EXPORT std::complex< double > itpp::mean ( const cmat &  m)

The mean value.

Definition at line 61 of file misc_stat.cpp.

References itpp::sum().

◆ mean() [7/8]

ITPP_EXPORT double itpp::mean ( const smat &  m)

The mean value.

Definition at line 66 of file misc_stat.cpp.

References itpp::sum().

◆ mean() [8/8]

ITPP_EXPORT double itpp::mean ( const imat &  m)

The mean value.

Definition at line 71 of file misc_stat.cpp.

References itpp::sum().

◆ geometric_mean() [1/2]

template<class T >
double itpp::geometric_mean ( const Vec< T > &  v)

The geometric mean of a vector.

Definition at line 139 of file misc_stat.h.

References itpp::Array< T >::length(), and itpp::prod().

◆ geometric_mean() [2/2]

template<class T >
double itpp::geometric_mean ( const Mat< T > &  m)

The geometric mean of a matrix.

Definition at line 146 of file misc_stat.h.

References itpp::prod().

◆ median()

template<class T >
double itpp::median ( const Vec< T > &  v)

The median.

Definition at line 154 of file misc_stat.h.

References itpp::Array< T >::length().

◆ norm() [1/10]

ITPP_EXPORT double itpp::norm ( const cvec &  v)

◆ norm() [2/10]

template<class T >
double itpp::norm ( const Vec< T > &  v)

Calculate the 2-norm: norm(v)=sqrt(sum(abs(v).^2))

Definition at line 166 of file misc_stat.h.

References itpp::Array< T >::size(), and itpp::sqr().

◆ norm() [3/10]

ITPP_EXPORT double itpp::norm ( const cvec &  v,
int  p 
)

Calculate the p-norm: norm(v,p)=sum(abs(v).^2)^(1/p)

Definition at line 86 of file misc_stat.cpp.

References itpp::Array< T >::size().

◆ norm() [4/10]

template<class T >
double itpp::norm ( const Vec< T > &  v,
int  p 
)

Calculate the p-norm: norm(v,p)=sum(abs(v).^2)^(1/p)

Definition at line 180 of file misc_stat.h.

References itpp::Array< T >::size().

◆ norm() [5/10]

ITPP_EXPORT double itpp::norm ( const cvec &  v,
const std::string &   
)

Calculate the Frobenius norm for s = "fro" (equal to 2-norm)

Definition at line 95 of file misc_stat.cpp.

References itpp::norm().

◆ norm() [6/10]

template<class T >
double itpp::norm ( const Vec< T > &  v,
const std::string &  s 
)

Calculate the Frobenius norm for s = "fro" (equal to 2-norm)

Definition at line 194 of file misc_stat.h.

References it_assert, itpp::Array< T >::size(), and itpp::sqr().

◆ norm() [7/10]

ITPP_EXPORT double itpp::norm ( const mat &  m,
int  p = 2 
)

Calculate the p-norm of a real matrix

p = 1: max(svd(m)) p = 2: max(sum(abs(X)))

Default if no p is given is the 2-norm

Definition at line 105 of file misc_stat.cpp.

References itpp::abs(), it_assert, itpp::max(), itpp::sum(), and itpp::svd().

◆ norm() [8/10]

ITPP_EXPORT double itpp::norm ( const cmat &  m,
int  p = 2 
)

Calculate the p-norm of a complex matrix

p = 1: max(svd(m)) p = 2: max(sum(abs(X)))

Default if no p is given is the 2-norm

Definition at line 121 of file misc_stat.cpp.

References itpp::abs(), it_assert, itpp::max(), itpp::sum(), and itpp::svd().

◆ norm() [9/10]

ITPP_EXPORT double itpp::norm ( const mat &  m,
const std::string &  s 
)

Calculate the Frobenius norm of a matrix for s = "fro".

Definition at line 133 of file misc_stat.cpp.

References it_assert.

◆ norm() [10/10]

ITPP_EXPORT double itpp::norm ( const cmat &  m,
const std::string &  s 
)

Calculate the Frobenius norm of a matrix for s = "fro".

Definition at line 146 of file misc_stat.cpp.

References it_assert.

◆ variance() [1/2]

ITPP_EXPORT double itpp::variance ( const cvec &  v)

◆ variance() [2/2]

template<class T >
double itpp::variance ( const Vec< T > &  v)

The variance of the elements in the vector. Normalized with N-1 to be unbiased.

Definition at line 237 of file misc_stat.h.

References itpp::Array< T >::size(), and itpp::sum().

◆ energy()

template<class T >
double itpp::energy ( const Vec< T > &  v)

Calculate the energy: squared 2-norm. energy(v)=sum(abs(v).^2)

Definition at line 253 of file misc_stat.h.

References itpp::norm(), and itpp::sqr().

Referenced by itpp::spectrum(), and itpp::xcorr_old().

◆ within_tolerance() [1/6]

bool itpp::within_tolerance ( double  x,
double  xref,
double  tol = 1e-14 
)
inline

Return true if the input value x is within the tolerance tol of the reference value xref.

Definition at line 260 of file misc_stat.h.

◆ within_tolerance() [2/6]

bool itpp::within_tolerance ( std::complex< double x,
std::complex< double xref,
double  tol = 1e-14 
)
inline

Return true if the input value x is within the tolerance tol of the reference value xref.

Definition at line 266 of file misc_stat.h.

References itpp::abs().

◆ within_tolerance() [3/6]

bool itpp::within_tolerance ( const vec &  x,
const vec &  xref,
double  tol = 1e-14 
)
inline

Return true if the input vector x is elementwise within the tolerance tol of the reference vector xref.

Definition at line 272 of file misc_stat.h.

References itpp::abs(), and itpp::max().

◆ within_tolerance() [4/6]

bool itpp::within_tolerance ( const cvec &  x,
const cvec &  xref,
double  tol = 1e-14 
)
inline

Return true if the input vector x is elementwise within the tolerance tol of the reference vector xref.

Definition at line 278 of file misc_stat.h.

References itpp::abs(), and itpp::max().

◆ within_tolerance() [5/6]

bool itpp::within_tolerance ( const mat &  X,
const mat &  Xref,
double  tol = 1e-14 
)
inline

Return true if the input matrix X is elementwise within the tolerance tol of the reference matrix Xref.

Definition at line 284 of file misc_stat.h.

References itpp::abs(), and itpp::max().

◆ within_tolerance() [6/6]

bool itpp::within_tolerance ( const cmat &  X,
const cmat &  Xref,
double  tol = 1e-14 
)
inline

Return true if the input matrix X is elementwise within the tolerance tol of the reference matrix Xref.

Definition at line 290 of file misc_stat.h.

References itpp::abs(), and itpp::max().

◆ moment()

ITPP_EXPORT double itpp::moment ( const vec &  x,
const int  r 
)

Calculate the central moment of vector x.

The $r$th sample central moment of the samples in the vector $ \mathbf{x} $ is defined as

\[
m_r = \mathrm{E}[x-\mu]^r = \frac{1}{n} \sum_{i=0}^{n-1} (x_i - \mu)^r
\]

where $\mu$ is the sample mean.

Definition at line 174 of file misc_stat.cpp.

References itpp::mean(), and itpp::Array< T >::size().

Referenced by itpp::kurtosisexcess(), and itpp::skewness().

◆ skewness()

ITPP_EXPORT double itpp::skewness ( const vec &  x)

Calculate the skewness excess of the input vector x.

The skewness is a measure of the degree of asymmetry of distribution. Negative skewness means that the distribution is spread more to the left of the mean than to the right, and vice versa if the skewness is positive.

The skewness of the samples in the vector $ \mathbf{x} $ is

\[
\gamma_1 = \frac{\mathrm{E}[x-\mu]^3}{\sigma^3}
\]

where $\mu$ is the mean and $\sigma$ the standard deviation.

The skewness is estimated as

\[
\gamma_1 = \frac{k_3}{{k_2}^{3/2}}
\]

where

\[
k_2 = \frac{n}{n-1} m_2
\]

and

\[
k_3 = \frac{n^2}{(n-1)(n-2)} m_3
\]

Here $m_2$ is the sample variance and $m_3$ is the 3rd sample central moment.

Definition at line 210 of file misc_stat.cpp.

References itpp::moment(), itpp::Array< T >::size(), and itpp::variance().

◆ kurtosisexcess()

ITPP_EXPORT double itpp::kurtosisexcess ( const vec &  x)

Calculate the kurtosis excess of the input vector x.

The kurtosis excess is a measure of peakedness of a distribution. The kurtosis excess is defined as

\[
  \gamma_2 = \frac{\mathrm{E}[x-\mu]^4}{\sigma^4} - 3
  \]

where $\mu$ is the mean and $\sigma$ the standard deviation.

The kurtosis excess is estimated as

\[
  \gamma_2 = \frac{k_4}{{k_2}^2}
  \]

where

\[
  k_2 = \frac{n}{n-1} m_2
  \]

and

\[
  k_4 = \frac{n^2 [(n+1)m_4 - 3(n-1){m_2}^2]}{(n-1)(n-2)(n-3)}
  \]

Here $m_2$ is the sample variance and $m_4$ is the 4th sample central moment.

Definition at line 220 of file misc_stat.cpp.

References itpp::moment(), itpp::Array< T >::size(), and itpp::variance().

Referenced by itpp::kurtosis().

◆ kurtosis()

double itpp::kurtosis ( const vec &  x)
inline

Calculate the kurtosis of the input vector x.

The kurtosis is a measure of peakedness of a distribution. The kurtosis is defined as

\[
\gamma_2 = \frac{\mathrm{E}[x-\mu]^4}{\sigma^4}
\]

where $\mu$ is the mean and $\sigma$ the standard deviation. For a Gaussian variable, the kurtusis is 3.

See also the definition of kurtosisexcess.

Definition at line 379 of file misc_stat.h.

References itpp::kurtosisexcess().

Generated on Tue Aug 17 2021 10:59:15 for IT++ by Doxygen 1.9.8