CDMatrixStat

Class Description

The CDMatrixStat class provides functions calculating statistics for the matrix and some statistical tests.

Constructors/Destructor

CDMatrixStat (void)

Default constructor. Creates an uninitialized matrix.

CDMatrixStat
    (int rows, int cols,
     double *storage = 0)

If storage is zero, create a dynamically sized double precision matrix with the number of rows and cols specified. If storage is not zero, use the memory it points to.

CDMatrixStat (const CDMatrixStat &mat)

Creates a matrix with the same properties and values as another matrix.
 
Argument Description
rows,cols number of rows and columns in matrix
storage pointer to previously allocated memory
mat reference to another matrix

~CDMatrixStat (void)
Destructor.
 

Top

Methods

Matrix Statistics 

CDMatrixStat::Mean

double Mean()

Return the mean value of the elements.

Top

CDMatrixStat::MeanCol
void MeanCol(CDVectorStat& vMean)

Calculate the mean value of the elements in each column.
 
Argument Description
vMean reference to vector holding the mean values

Top


CDMatrixStat::Std

double Std()

Return the standard deviation of the elements.

Top

CDMatrixStat::StdCol
void StdCol(CDVectorStat& vStd)

Calculate the standard deviation of the elements in each column.
 
Argument Description
vStd reference to vector holding the standard deviations

Top

CDMatrixStat::Sum
double Sum()

Return the sum of the elements.

Top

CDMatrixStat::SumCol
void SumCol(CDVectorStat& vSum)

Calculate the sum of the elements in each column.
 
Argument Description
vSum reference to vector holding the sums

Top

CDMatrixStat::Var
double Var()

Return the variance of the elements.

Top

CDMatrixStat::VarCol
void VarCol(CDVectorStat& vVar)

Calculate the variance of the elements in each column.
 
Argument Description
vVar reference to vector holding the variance

Top


Statistical Tests 

CDMatrixStat:: OneWayANOVA

void OneWayANOVA(double& dZ, int& nDFModel, int& nDFError)

Perform a one way analysis of variance, where each column in the matrix corresponds to a set of observations, which are assumed to be Gaussian distributed, i.e.

Hypothesis:    mean1 = mean2 = mean3 = ...

Reject region:    dz > F(nDFModel, nDFError )_{1-alpha}
 
Argument Description
dZ test statistics
nDFModel degrees of freedom for the model
nDFError degrees of freedom for the error

 

CDMatrixStat:: TTest
void TTest(const int iCol1,const int iCol2, double& dZ, int& nDF)

Perform a t-test on the observations corresponding to columns iCol1 and iCol2, which are assumed to be Gaussian distributed observation,  i.e.

Hypothesis:    mean1 = mean2

Reject region:    dZ < t(nDF)_alpha    v    dZ > t(nDF)_{1-alpha}

Note, that the variance estimate used in the t-test is created by a pulled variance based on all the columns in the matrix.
 
Argument Description
iCol1, iCol2 index to columns, which corresponds to the two set of observations
dZ test statistics
nDF degrees of freedom


Miscellaneous 

CDMatrixStat::ToString

void ToString(CString& strOut)

This function returns a string representing the vector.
 
Argument Description
strOut reference to the string

Overloaded Operators 

CDMatrixStat::operator=

CDMatrixStat& operator= (double value)
Assigns value to all elements of this matrix.

CDMatrixStat& operator= (const CDMatrixStat& vec)
Copies the values of another matrix to the corresponding elements of this matrix.
 
Argument Description
value value to be assigned to this matrix's elements
vec reference to matrix with values to be copied


Copyright, 1999
Section for Image Analysis
Department of Mathematical Modelling
Technical University of Denmark
DK-2800 Lyngby

Authors: Rune Fisker

Last updated: 03-05-1999