Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   Related Pages  

Confidence.h

00001 //   -*- C++ -*-
00002 /*****************************************************************************
00003  *
00004  *   |_|_|_  |_|_    |_    |_|_|_  |_                C O M M U N I C A T I O N
00005  * |_        |_  |_  |_  |_        |_                          N E T W O R K S
00006  * |_        |_  |_  |_  |_        |_                                C L A S S
00007  *   |_|_|_  |_    |_|_    |_|_|_  |_|_|_|_                      L I B R A R Y
00008  *
00009  *
00010  * CNClass: CNConfidence --- Simple stat. evaluation: mean, variance,
00011  *                           skewness etc.
00012  *
00013  * Derived from SIC - Simulation In C++
00014  *
00015  *****************************************************************************
00016  * Copyright (C) 1992-2002   Communication Networks
00017  *                           Aachen University of Technology
00018  *                           D-52056 Aachen
00019  *                           Germany
00020  *                           Email: cncl-adm@comnets.rwth-aachen.de
00021  *****************************************************************************
00022  * This file is part of the CN class library. All files marked with
00023  * this header are free software; you can redistribute it and/or modify
00024  * it under the terms of the GNU Library General Public License as
00025  * published by the Free Software Foundation; either version 2 of the
00026  * License, or (at your option) any later version.  This library is
00027  * distributed in the hope that it will be useful, but WITHOUT ANY
00028  * WARRANTY; without even the implied warranty of MERCHANTABILITY or
00029  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
00030  * License for more details.  You should have received a copy of the GNU
00031  * Library General Public License along with this library; if not, write
00032  * to the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139,
00033  * USA.
00034  *****************************************************************************/
00035 
00036 #ifndef __Confidence_h
00037 #define __Confidence_h
00038 #include <CNCL/Statistics.h>            // Base class
00039 
00040 extern CNClassDesc CN_CONFIDENCE;       // CNClass CNConfidence description
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     /****** Constructors ******************************************************/
00111   public:
00113     CNConfidence(const char* aName = NIL,
00114               const char* aDescription = NIL);
00116     CNConfidence(CNParam *) {}                  // CNParam constructor
00117     
00118     /****** Member functions required by CNCL *********************************/
00119   public:
00121     virtual CNClassDesc class_desc() const      
00122     {
00123         return CN_CONFIDENCE;
00124     };
00125             
00127     virtual bool is_a(CNClassDesc desc) const   // Type checking
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  * Local Variables:
00159  * mode: c++
00160  * folded-file: t
00161  * tab-width:4
00162  * comment-column:40
00163  * End:
00164  */
00165 
00166 // }}}

Generated on Fri Feb 1 19:53:46 2002 for CNCL by doxygen1.2.13.1 written by Dimitri van Heesch, © 1997-2001