Jacknife.h
Go to the documentation of this file.00001 #ifndef CJACKNIFE_H_
00002 #define CJACKNIFE_H_
00003 #include <numeric>
00004 #include "StatErrEst.h"
00005 #include "statutils.h"
00006
00007 namespace gplib
00008 {
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 template<class SampleGenerator>
00020 class Jacknife: public StatErrEst<SampleGenerator>
00021 {
00022 private:
00023
00024 virtual void CalcErrors_Imp(double &m, double &v);
00025 public:
00026
00027 Jacknife(const int nrea, SampleGenerator TheGenerator) :
00028 StatErrEst<SampleGenerator>::StatErrEst(nrea, TheGenerator)
00029 {
00030 }
00031 virtual ~Jacknife()
00032 {
00033 }
00034 };
00035
00036
00037
00038 template<class SampleGenerator>
00039 void Jacknife<SampleGenerator>::CalcErrors_Imp(double &m, double &v)
00040 {
00041 m = Mean(this->Samples.begin(), this->Samples.end());
00042 if (this->nrealizations < 2)
00043 {
00044 v = 0;
00045 return;
00046 }
00047 v = Variance(this->Samples.begin(), this->Samples.end(), m);
00048 }
00049 }
00050 #endif