00001 00005 class EmpiricalStatistics 00006 00007 { 00008 protected: 00009 int nsamples; 00010 String response_name; 00011 00012 bool new_samples_collected; 00013 00014 EmpiricalStatistics (); 00015 00016 void init () { nsamples = 0; new_samples_collected = true; } 00017 00018 public: 00019 virtual ~EmpiricalStatistics (); 00020 int getNoSamples () { return nsamples; } 00021 void setResponseName (const String& name) { response_name = name; } 00022 String getResponseName () { return response_name; } 00023 }; 00024 00025 00064 class ExpecVar : public EmpiricalStatistics 00065 00066 { 00067 protected: 00068 00069 real zm1; 00070 real zm2; 00071 00072 real exp; 00073 real var; 00074 00075 void estimator (); 00076 00077 public: 00078 00079 ExpecVar () 00080 : EmpiricalStatistics () { zm1 = zm2 = 0; } 00081 ~ExpecVar () { } 00082 00083 void init () { zm1 = zm2 = nsamples = 0; } 00084 void update (real random_variable); 00085 void printResults (Os os); 00086 void intermediateResults (Os os); 00087 00088 real getExpec () { estimator(); return exp; } 00089 real getStDev () { estimator(); return sqrt(var); } 00090 }; 00091 00092 00147 class Moments : public ExpecVar 00148 00149 { 00150 protected: 00151 real zm3; 00152 real zm4; 00153 00154 real skew; 00155 real kurt; 00156 00157 void estimator (); 00158 00159 public: 00160 00161 Moments () : ExpecVar() { zm3 = zm3 = 0; } 00162 ~Moments (); 00163 00164 void init (); 00165 void update (real random_variable); 00166 00167 void printResults (Os os); 00168 void intermediateResults (Os os); 00169 00170 real getSkewness () { estimator(); return skew; } 00171 real getKurtosis () { estimator(); return kurt; } 00172 }; 00173 00174 00210 class Extremes : public ExpecVar 00211 00212 { 00213 protected: 00214 real min; 00215 real max; 00216 int min_sample_no; 00217 int max_sample_no; 00218 00219 public: 00220 00221 Extremes () : ExpecVar() { min = INFINITY; max = -min; } 00222 ~Extremes (); 00223 00224 void init (); 00225 void update (real sample); 00226 00227 void printResults (Os os); 00228 void intermediateResults (Os os); 00229 00230 real getMax () { return max; } 00231 real getMin () { return min; } 00232 }; 00233 00234