00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036 #ifndef __Confidence_h
00037 #define __Confidence_h
00038 #include <CNCL/Statistics.h>
00039
00040 extern CNClassDesc CN_CONFIDENCE;
00041
00045 class CNConfidence : public CNStatistics {
00046 public:
00048 virtual void put(double x_i);
00050 virtual double mean() const;
00052 virtual void reset();
00054 double variance() const;
00056 double M_2() const;
00058 double M_3() const;
00060 double Z_3() const;
00062 double relative_variance() const;
00064 double deviation() const;
00066 double relative_deviation() const;
00068 double skewness() const;
00070 double z_level(double) const;
00072 double conf_level(double ) const;
00074 double err_level(double ) const;
00076 double low_conf_bound(double ) const;
00078 double hi_conf_bound(double ) const;
00079
00081 virtual unsigned long trials() const { return n; }
00083 virtual double maximum() const { return max_value; }
00085 virtual double minimum() const { return min_value; }
00086
00088 virtual bool end() const { return FALSE; }
00090 virtual Phase state() const { return ITERATE; }
00092 virtual Phase status() const { return ITERATE; }
00093
00095 private:
00096 CNString name;
00097 double sum ;
00098 double sqsum ;
00099 double cbsum ;
00100 long n;
00101 double min_value;
00102 double max_value;
00103
00104 typedef struct ez_level{double z,conf; }
00105 s_ezl;
00107 static struct ez_level level[];
00108
00109
00110
00111 public:
00113 CNConfidence(const char* aName = NIL,
00114 const char* aDescription = NIL);
00116 CNConfidence(CNParam *) {}
00117
00118
00119 public:
00121 virtual CNClassDesc class_desc() const
00122 {
00123 return CN_CONFIDENCE;
00124 };
00125
00127 virtual bool is_a(CNClassDesc desc) const
00128 {
00129 return desc == CN_CONFIDENCE ? TRUE : CNStatistics::is_a(desc);
00130 };
00131
00133 static CNConfidence *cast_from_object(CNObject *obj)
00134 {
00135 # ifdef NO_TYPE_CHECK
00136 return (CNConfidence *)obj;
00137 # else
00138 return (CNConfidence *)( obj->is_a(CN_CONFIDENCE)
00139 ? obj : fatal_type(obj->class_desc(), CN_CONFIDENCE) );
00140 # endif
00141 }
00142
00144 static CNObject *new_object(CNParam *param = NIL)
00145 { return param ? new CNConfidence(param) : new CNConfidence; }
00146
00148 virtual void print(ostream &strm = cout) const;
00150 virtual void dump (ostream &strm = cout) const;
00151 };
00152
00153 #endif
00155 // {{{ Emacs Local Variables
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166