00001 #ifndef __BCGOFTEST__H 00002 #define __BCGOFTEST__H 00003 00004 /*! 00005 * \class BCGoFTest 00006 * \brief The class for testing model hypotheses 00007 * \author Daniel Kollar 00008 * \author Kevin Kröninger 00009 * \version 1.0 00010 * \date 08.2008 00011 * \detail This class is used for calculating the p-value of a model. 00012 */ 00013 00014 /* 00015 * Copyright (C) 2008-2010, Daniel Kollar and Kevin Kroeninger. 00016 * All rights reserved. 00017 * 00018 * For the licensing terms see doc/COPYING. 00019 */ 00020 00021 // --------------------------------------------------------- 00022 00023 #include "BAT/BCModel.h" 00024 00025 // ROOT classes 00026 class TH1D; 00027 00028 // BAT classes 00029 class BCDataSet; 00030 00031 // --------------------------------------------------------- 00032 00033 class BCGoFTest : public BCModel 00034 { 00035 public: 00036 00037 /** \name Constructors and destructors */ 00038 /* @{ */ 00039 00040 /** 00041 * Default constructor. 00042 */ 00043 BCGoFTest(const char * name); 00044 00045 /** 00046 * Default destructor. */ 00047 ~BCGoFTest(); 00048 00049 /* @} */ 00050 /** \name Member functions (get) */ 00051 /* @{ */ 00052 00053 /* 00054 * Calculated the p-value. 00055 * @param flag_histogram A histogram is either filled or not. 00056 * @return p-value */ 00057 double GetCalculatedPValue(bool flag_histogram = false); 00058 00059 /* 00060 * @return distribution of log(likelihood) */ 00061 TH1D * GetHistogramLogProb() 00062 { return fHistogramLogProb; }; 00063 00064 /* 00065 * @return pointer to the tested model */ 00066 BCModel * GetTestModel() 00067 { return fTestModel; }; 00068 00069 /* @} */ 00070 /** \name Member functions (set) */ 00071 /* @{ */ 00072 00073 /* 00074 * Set the model to be tested. 00075 * @param testmodel pointer to the model to be tested */ 00076 void SetTestModel(BCModel * testmodel) 00077 { fTestModel = testmodel; }; 00078 00079 /* 00080 * Sets the set of parameters which the p-values is calculated for. 00081 * @param parameters parameters 00082 * @return error code */ 00083 int SetTestPoint(std::vector<double> parameters); 00084 00085 /* @} */ 00086 /** \name Member functions (miscellaneous methods) */ 00087 /* @{ */ 00088 00089 double LogLikelihood(std::vector <double> parameters); 00090 00091 double LogAPrioriProbability(std::vector <double> parameters) 00092 { return 0; }; 00093 00094 void MCMCUserIterationInterface(); 00095 00096 /* @} */ 00097 00098 private: 00099 00100 /* 00101 * A map of data points and data values. */ 00102 std::vector<int> fMapDataPoint; 00103 std::vector<int> fMapDataValue; 00104 00105 /* 00106 * Counter for the evaluation of the p-value. */ 00107 int fPValueBelow; 00108 int fPValueAbove; 00109 00110 /* 00111 * A pointer to the model which is tested. */ 00112 BCModel * fTestModel; 00113 00114 /* 00115 * A data set used for temporary storage. */ 00116 BCDataSet * fTemporaryDataSet; 00117 00118 /* 00119 * The log(likelihood) and its range. */ 00120 double fLogLikelihood; 00121 double fLogLikelihoodMin; 00122 double fLogLikelihoodMax; 00123 00124 /* 00125 * The distribution of log(likelihood). */ 00126 TH1D * fHistogramLogProb; 00127 }; 00128 00129 // --------------------------------------------------------- 00130 00131 #endif