LTI-Lib latest version v1.9 - last update 10 Apr 2010

lti::chiSquareFunctor Class Reference

chiSquareFunctor calculates the chiSquareValue indicating the likelihood, that the considerd elements are drawn from a gaussian normal distribution. More...

#include <ltiChiSquareFunctor.h>

Inheritance diagram for lti::chiSquareFunctor:
Inheritance graph
[legend]
Collaboration diagram for lti::chiSquareFunctor:
Collaboration graph
[legend]

List of all members.

Classes

class  parameters
 the parameters for the class chiSquareFunctor More...

Public Member Functions

 chiSquareFunctor ()
 chiSquareFunctor (const chiSquareFunctor &other)
virtual ~chiSquareFunctor ()
virtual const char * getTypeName () const
chiSquareFunctorcopy (const chiSquareFunctor &other)
chiSquareFunctoroperator= (const chiSquareFunctor &other)
virtual functorclone () const
const parametersgetParameters () const
void consider (const double &element)
bool consider (const double &element, const int freq)
bool consider (const lti::vector< double > element)
bool consider (const vector< double > element, const int freq)
int getNumberOfIntervalls () const
bool apply (double &chiSquare)
double getChiSquareValue ()
void showElementList ()
void resetElements ()
double getVarianceOfData ()
double getMeanOfData ()

Detailed Description

chiSquareFunctor calculates the chiSquareValue indicating the likelihood, that the considerd elements are drawn from a gaussian normal distribution.

All results are written to the file chiSquareInfo.txt (the use may specify another name for this file)

the default parameter values are optimal for integer data Mean and variance of the distribution are drawn from the data if the user has not specified other values.

For a similar algorithm of the Chi-Square Test and numerical integration see "Numerical Recipes in C (Cambridge University Press)"

example:

   double data[] = {2,5,6,7.5,8,9,7,6,5,4,3};
   lti::vector<double> vct(11,data);

   double chiSquare;
   lti::chiSquareFunctor csf;

   lti::chiSquareFunctor::parameters param;  // set a parameter
   param.minimalWidth = 0.5;
   csf.setParameters(param);

   csf.consider(vct);
   csf.apply(chiSquare);

   std::cout << "chiSquare: " << chiSquare << std::endl;
   std::cout << "numberOfIntervalls: "
             << csf.getNumberOfIntervalls() << std::endl;
   std::cout << csf.getStatusString() << std::endl;// gives information
                                                   // when an error ocurred

Constructor & Destructor Documentation

lti::chiSquareFunctor::chiSquareFunctor (  ) 

default constructor

lti::chiSquareFunctor::chiSquareFunctor ( const chiSquareFunctor other  ) 

copy constructor

Parameters:
other the object to be copied
virtual lti::chiSquareFunctor::~chiSquareFunctor (  )  [virtual]

destructor


Member Function Documentation

bool lti::chiSquareFunctor::apply ( double &  chiSquare  ) 

result of Chi-Square test will be stored in chiSquare

virtual functor* lti::chiSquareFunctor::clone (  )  const [virtual]

returns a pointer to a clone of this functor.

Implements lti::functor.

bool lti::chiSquareFunctor::consider ( const vector< double >  element,
const int  freq 
)

considers the vector freq times (adds it to intern element list) returns false if freq equals zero or has a negative value or if vector is empty

bool lti::chiSquareFunctor::consider ( const lti::vector< double >  element  ) 

considers each element of the vector (adds it to intern element list) returns false if vector is empty

bool lti::chiSquareFunctor::consider ( const double &  element,
const int  freq 
)

considers one Element freq times (adds it to intern element list) returns false if freq equals zero or has a negative value

void lti::chiSquareFunctor::consider ( const double &  element  ) 

considers one Element (adds it to intern element list)

chiSquareFunctor& lti::chiSquareFunctor::copy ( const chiSquareFunctor other  ) 

copy data of "other" functor.

Parameters:
other the functor to be copied
Returns:
a reference to this functor object

Reimplemented from lti::functor.

double lti::chiSquareFunctor::getChiSquareValue (  ) 

returns the chiSquareValue, after the apply function has been called if apply has not been called, getChiSqureValue returns negative -1.0;

double lti::chiSquareFunctor::getMeanOfData (  ) 

returns the mean of the given data returns 0 if no data has been given before call of getMean does NOT return the mean the user specified mean is calculated with lti::serialStatsFunctor

int lti::chiSquareFunctor::getNumberOfIntervalls (  )  const

if apply function has not been called jet, or maximal number of Intervalls was not specified: returns 100

const parameters& lti::chiSquareFunctor::getParameters (  )  const

returns used parameters

Reimplemented from lti::functor.

virtual const char* lti::chiSquareFunctor::getTypeName (  )  const [virtual]

returns the name of this type ("chiSquareFunctor")

Reimplemented from lti::functor.

double lti::chiSquareFunctor::getVarianceOfData (  ) 

returns the variance of the given data returns 0 if no data has been given before call of getVariance does NOT return the variance the user specified variance is calculated with lti::serialStatsFunctor

chiSquareFunctor& lti::chiSquareFunctor::operator= ( const chiSquareFunctor other  ) 

alias for copy member

Parameters:
other the functor to be copied
Returns:
a reference to this functor object

Reimplemented from lti::functor.

void lti::chiSquareFunctor::resetElements (  ) 

deletes all elements from m_ElementList, intervallList and intervallBorders

void lti::chiSquareFunctor::showElementList (  ) 

to check the inhold of the elementList elements are printed to standard output


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

Generated on Sat Apr 10 15:28:11 2010 for LTI-Lib by Doxygen 1.6.1