latest version v1.9 - last update 10 Apr 2010 |
chiSquareFunctor calculates the chiSquareValue indicating the likelihood, that the considerd elements are drawn from a gaussian normal distribution. More...
#include <ltiChiSquareFunctor.h>
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 |
chiSquareFunctor & | copy (const chiSquareFunctor &other) |
chiSquareFunctor & | operator= (const chiSquareFunctor &other) |
virtual functor * | clone () const |
const parameters & | getParameters () 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 () |
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
lti::chiSquareFunctor::chiSquareFunctor | ( | ) |
default constructor
lti::chiSquareFunctor::chiSquareFunctor | ( | const chiSquareFunctor & | other | ) |
copy constructor
other | the object to be copied |
virtual lti::chiSquareFunctor::~chiSquareFunctor | ( | ) | [virtual] |
destructor
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 | |||
) |
bool lti::chiSquareFunctor::consider | ( | const lti::vector< double > | element | ) |
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.
other | the functor to be copied |
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 | ) |
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