00001 #ifndef STAT2_CLASS_HEADER
00002 #define STAT2_CLASS_HEADER
00003
00004
00005
00011
00012
00013
00014
00015 #include <stdlib.h>
00016
00017 #ifdef _STANDARD_C_PLUS_PLUS
00018 #include <iostream>
00019 using namespace std;
00020 #else
00021 #include <iostream.h>
00022 #endif
00023
00024
00025
00026 #include "Utilsexc.hh"
00027 #include "Statexc.hh"
00028 #include "Iovar.hh"
00029
00030
00031
00032 namespace RazorBack {
00033
00040 class Stat_
00041 {
00042
00043 static const double BIG_NUMBER;
00044 static const double SMALL_NUMBER;
00045
00046 double Sx, Sx2, Sx3, Sx4;
00047 double Min, Max;
00048 unsigned int N;
00049
00050
00051 public:
00052
00054 Stat_(): Sx(0.0), Sx2(0.0), Sx3(0.0), Sx4(0.0),
00055 Min(BIG_NUMBER), Max(-BIG_NUMBER), N(0) {}
00056
00058 void clear()
00059 {
00060 Sx=Sx2=Sx3=Sx4=0.0;
00061 Min=BIG_NUMBER; Max=-Min; N=0;
00062 }
00063
00065 Stat_& operator+=(double Val);
00066
00068 unsigned int data_no() const { return N; }
00069
00074 double min() const;
00075 double max() const;
00076
00081 double avg() const;
00082
00087 double sd() const;
00088
00094 double skew() const;
00095
00104 double kurt() const;
00105
00106
00107
00122 friend ostream& operator<<(ostream& Out, const Stat_& S);
00123
00138 friend istream& operator>>(istream& In, Stat_& S);
00139 };
00140
00141
00149 class Stat2_
00150 {
00151
00152 Stat_ Xs, Ys;
00153 double Sxy;
00154
00155
00156 public:
00157
00159 Stat2_(): Xs(), Ys(), Sxy(0.0) {}
00160
00162 void clear() { Xs.clear(); Ys.clear(); Sxy=0.0; }
00163
00165 void add(double X, double Y) { Xs+=X; Ys+=Y; Sxy+=X*Y; }
00166
00168 unsigned int data_no() const { return(Xs.data_no()); }
00169
00174 const Stat_& xs() const { return(Xs); }
00175 const Stat_& ys() const { return(Ys); }
00176
00182 double corr() const;
00183 };
00184
00185
00186
00187
00188 }
00189
00190 #endif // STAT2_CLASS_HEADER