Statistics::CorrCoef Function

Overload List

#SignatureDescription
1void CorrCoef(TDenseMtxVec *X, TDenseMtxVec *Y, TMtx *aResult);Pearson correlation coefficients.
2void CorrCoef(TDenseMtxVec *X, TDenseMtxVec *Y, TMtx *aResult, double &tValue);Pearson correlation coefficients.
3void CorrCoef(TMtx *X, TMtx *aResult);Pearson correlation coefficients between matrix rows and cols.

Overload 1: void CorrCoef(TDenseMtxVec *X, TDenseMtxVec *Y, TMtx *aResult);

Pearson correlation coefficients.

#NameTypeDescription
1XTDenseMtxVec *Defines first sample (variable) values (observables).
2YTDenseMtxVec *Defines second sample (variable) values (observables).
3aResultTMtx *Returns Pearson correlation coefficients bewteen samples X and Y. Size of Result is adjusted automatically.
Remarks:

Correlation coefficient

The correlation coefficient rho between two random variables is defined by the following equation:

ρ(x,y)=Cov(x,y)σxσy=E(xy)E(x)E(y)E(x2)E(x)2E(y2)E(y)2.\rho_{(x,y)} = \cfrac{\text{Cov}(x,y)}{\sigma_x \sigma_y} = \cfrac{E (x y)-E(x) E(y)}{\sqrt{E(x^2)-E(x)^2}\sqrt{E(y^2)-E(y)^2}}\qquad .

where x,y are two variables, Cov covariance betwen x and y, sigma(s) their expected standard deviations and E-s their expected values. If the variables are independent then the correlation is 0, but the converse is not true because the correlation coefficient detects only linear dependencies between two variables.

Sample correlation coefficients.

If we have a series of n measurements of X and Y, then the Pearson product-moment correlation coefficient can be used to estimate the correlation of X and Y. The Pearson coefficient is also known as the "sample correlation coefficient". The Pearson correlation coefficient is then the best estimate of the correlation of X and Y .

Declared in Dew::Stats::Units::Statistics · Dew.Stats/Units.Statistics.h · Cross-compiler

Overload 2: void CorrCoef(TDenseMtxVec *X, TDenseMtxVec *Y, TMtx *aResult, double &tValue);

Pearson correlation coefficients.

#NameTypeDescription
1XTDenseMtxVec *
2YTDenseMtxVec *
3aResultTMtx *
4tValuedouble &
Remarks:

Additionally returns also the Students t-distribution value as an indicator of statistical significance.

Declared in Dew::Stats::Units::Statistics · Dew.Stats/Units.Statistics.h · Cross-compiler

Overload 3: void CorrCoef(TMtx *X, TMtx *aResult);

Pearson correlation coefficients between matrix rows and cols.

#NameTypeDescription
1XTMtx *
2aResultTMtx *
Remarks:

This version calculates Pearson correlation coefficients rx,y between X matrix rows and cols. X colums are treated as samples (variables) and rows as values (observables).

Declared in Dew::Stats::Units::Statistics · Dew.Stats/Units.Statistics.h · Cross-compiler