INGOR
Public Member Functions | List of all members
ytStat Class Reference

Statistical routines. More...

#include <math/ytStat.h>

Public Member Functions

double ytStat_dnorm (double x, double m, double sd)
 Calculates the density function of the normal distribution. More...
 
void ytStat_mvmean (const double *X, int n, int p, int N, double *mean)
 Calculates the mean of all the variables. More...
 
void ytStat_mvcov (const double *X, int n, int p, int N, const double *m, double *S)
 Calculates the covariance matrix. More...
 
double ytStat_mvdnorm (const double *x, int p, int N, const double *u, const double *Sinv, double detS)
 Calculates the density of the multivariate normal distribution. More...
 
double ytStat_logmvdnorm (const double *x, int p, int N, const double *u, const double *Sinv, double logDetS)
 Calculates the log of multivariate normal distribution density. More...
 

Detailed Description

Statistical routines.

See also
ytMatrix

Member Function Documentation

◆ ytStat_dnorm()

double ytStat_dnorm ( double  x,
double  m,
double  sd 
)

Calculates the density function of the normal distribution.

Parameters
x
mparameter mean
sdparameter sd (not variance σ2).

◆ ytStat_logmvdnorm()

double ytStat_logmvdnorm ( const double *  x,
int  p,
int  N,
const double *  u,
const double *  Sinv,
double  logDetS 
)

Calculates the log of multivariate normal distribution density.

See non-log version ytStat_mvdnorm() for details. Note that the determinant of Σ is given by log(|Σ|).

Parameters
xp input vector.
pdimension of x.
Nstride of x.
umean vector (μ).
SinvUpper triangular symmetric matrix of inverse of the p by p covariance matrix (Σ-1).
logDetSlog of determinant of the convariance matrix (log(|Σ|)).

◆ ytStat_mvcov()

void ytStat_mvcov ( const double *  X,
int  n,
int  p,
int  N,
const double *  m,
double *  S 
)

Calculates the covariance matrix.

Parameters
[in]Xcolumn major n by p input data matrix. Each column represents a set of samples of a variable.
[in]nNumber of rows (sampls) in X.
[in]pNumber of columns (variables) in X.
[in]NStride width of X.
[in]mp mean vector where the j-th elemente represents the mean of the j -th variable.
[out]Sp by p upper triangular matrix where element s i,j ( ij ) represents covariance of the i -th and j -th column.

◆ ytStat_mvdnorm()

double ytStat_mvdnorm ( const double *  x,
int  p,
int  N,
const double *  u,
const double *  Sinv,
double  detS 
)

Calculates the density of the multivariate normal distribution.

The mean vector can be calculated by ytStat_mvmean(), and the covariance matrix can be calculated by ytStat_mvcov().

The inverse of the covariance matrix Σ returned by ytStat_mvcov() can be calculated by ytMatrix_dsytrf() and ytMatrix_dsytri().

Parameters
xp input vector.
pdimension of input value x.
umean vector (μ).
SinvUpper triangular symmetric matrix of inverse of the p by p covariance matrix (Σ-1).
detSdeterminant of the covariance matrix (|Σ|).

◆ ytStat_mvmean()

void ytStat_mvmean ( const double *  X,
int  n,
int  p,
int  N,
double *  mean 
)

Calculates the mean of all the variables.

Parameters
[in]Xcolumn major n by p input data matrix. Each column represents a set of samples of a variable.
[in]nNumber of rows (samples) in X.
[in]pNumber of columns (variables) in X.
[in]NStride width of X.

The documentation for this class was generated from the following file: