00001
00024 #ifndef _STATISTICS_H
00025 #define _STATISTICS_H
00026
00027 #include "../util/defines.h"
00028
00031 class Statistics
00032 {
00033 private:
00034
00036 unsigned long num;
00038 double sum;
00040 double squaresum;
00042 const unsigned int maxAcfOrder;
00044 double* acfSums;
00046 double* acfLagSums;
00048 list<double> acfWindow;
00052 unsigned long numTurningPoints;
00056 unsigned long numPositiveDifferences;
00058 double lastVal1, lastVal2;
00059
00060 public:
00075 Statistics(unsigned int maxAcfOrder, bool useExactCalculation = true);
00076 ~Statistics();
00077
00079 void nextSample(double value);
00080
00082 unsigned long getNum() const;
00083
00085 double getMean() const;
00086
00088 double getVariance() const;
00089
00097 double getAcf(unsigned int lag) const;
00098
00100 static void testIncrementalAcf(unsigned int maxAcfOrder, double* values, unsigned int len, double accuracy);
00101
00115 bool isIidAcf() const;
00116
00127 bool isIidTurningPoint() const;
00128
00142 bool isIidDifferenceSign() const;
00143
00154 bool isIid() const;
00155
00172 unsigned int getMaModelOrder() const;
00173
00174 };
00175
00176 #endif