BAT  0.9.4
The Bayesian analysis toolkit
 All Classes Namespaces Functions Variables Enumerations
BCModelManager Class Reference

A class representing a set of BCModels. More...

#include <BCModelManager.h>

Public Member Functions

Constructors and destructors
 BCModelManager ()
 
 BCModelManager (const BCModelManager &modelmanager)
 
virtual ~BCModelManager ()
 
Assignment operators
BCModelManageroperator= (const BCModelManager &modelmanager)
 
Member functions (get)
unsigned int GetNModels ()
 
BCModelGetModel (int index)
 
int GetNDataPoints ()
 
BCDataPointGetDataPoint (int index)
 
BCDataSetGetDataSet ()
 
Member functions (set)
void SetDataSet (BCDataSet *dataset)
 
void SetSingleDataPoint (BCDataPoint *datapoint)
 
void SetSingleDataPoint (BCDataSet *dataset, unsigned int index)
 
void SetNIterationsMax (int niterations)
 
void SetNIterationsMin (int niterations)
 
void SetNIterationsPrecisionCheck (int niterations)
 
void SetNIterationsOutput (int niterations)
 
void SetMarginalizationMethod (BCIntegrate::BCMarginalizationMethod method)
 
void SetIntegrationMethod (BCIntegrate::BCIntegrationMethod method)
 
void SetOptimizationMethod (BCIntegrate::BCOptimizationMethod method)
 
void SetRelativePrecision (double relprecision)
 
void SetAbsolutePrecision (double absprecision)
 
void SetNbins (unsigned int n)
 
void SetDataPointLowerBoundaries (BCDataPoint *datasetlowerboundaries)
 
void SetDataPointUpperBoundaries (BCDataPoint *datasetupperboundaries)
 
void SetDataPointLowerBoundary (int index, double lowerboundary)
 
void SetDataPointUpperBoundary (int index, double upperboundary)
 
void SetDataBoundaries (int index, double lowerboundary, double upperboundary)
 
void SetNChains (unsigned int n)
 
Member functions (miscellaneous methods)
void AddModel (BCModel *model, double probability=0.)
 
void AddDataPoint (BCDataPoint *datapoint)
 
int ReadDataFromFile (const char *filename, const char *treename, const char *branchnames)
 
int ReadDataFromFile (const char *filename, int nvariables)
 
int ReadDataFromFileTree (const char *filename, const char *treename, const char *branchnames)
 
int ReadDataFromFileTxt (const char *filename, int nbranches)
 
void Integrate ()
 
double BayesFactor (const unsigned int imodel1, const unsigned int imodel2)
 
void FindMode ()
 
void MarginalizeAll ()
 
void WriteMarkovChain (bool flag)
 
void ResetDataSet ()
 
void PrintModelComparisonSummary (const char *filename=0)
 
void PrintSummary (const char *filename=0)
 
void PrintResults ()
 
void CalculatePValue (bool flag_histogram=false)
 

Detailed Description

A class representing a set of BCModels.

Author
Daniel Kollar
Kevin Kröninger
Version
1.0
Date
08.2008 This class represents a manager for BCModels. It handles common data sets and performs operations on BCModels simultaneously. Model comparsion in terms of a posteriori probabilities is only possible with this class.

Definition at line 32 of file BCModelManager.h.

Constructor & Destructor Documentation

BCModelManager::BCModelManager ( )

The default constructor.

Definition at line 23 of file BCModelManager.cxx.

BCModelManager::BCModelManager ( const BCModelManager modelmanager)

The default copy constructor.

Definition at line 39 of file BCModelManager.cxx.

BCModelManager::~BCModelManager ( )
virtual

The default destructor.

Definition at line 31 of file BCModelManager.cxx.

Member Function Documentation

void BCModelManager::AddDataPoint ( BCDataPoint datapoint)
inline

Adds a data point to the data container.

Parameters
datapointThe data point

Definition at line 208 of file BCModelManager.h.

void BCModelManager::AddModel ( BCModel model,
double  probability = 0. 
)

Adds a model to the container

Parameters
modelThe model
probabilityThe a priori probability
See Also
AddModel(BCModel * model)
SetModelPrior(BCModel * model, double probability)

Definition at line 92 of file BCModelManager.cxx.

double BCModelManager::BayesFactor ( const unsigned int  imodel1,
const unsigned int  imodel2 
)

Calculate Bayes factor for two models.

Parameters
imodel1index of model 1 (numerator)
imodel2index of model 2 (denominator)
Returns
Bayes factor or -1. on error

Definition at line 329 of file BCModelManager.cxx.

void BCModelManager::CalculatePValue ( bool  flag_histogram = false)

Calculates the p-value for all models.

Definition at line 404 of file BCModelManager.cxx.

void BCModelManager::FindMode ( )

Does the mode finding

Definition at line 377 of file BCModelManager.cxx.

BCDataPoint* BCModelManager::GetDataPoint ( int  index)
inline

Returns a data point of the common data set at an index.

Parameters
indexThe index of the data point in the data set.
Returns
The data point.

Definition at line 87 of file BCModelManager.h.

BCDataSet* BCModelManager::GetDataSet ( )
inline

Returns the common data set.

Returns
The data set.

Definition at line 93 of file BCModelManager.h.

BCModel* BCModelManager::GetModel ( int  index)
inline

Returns the BCModel at a certain index of this BCModelManager.

Parameters
indexThe index of the model in the BCModelManager.
Returns
The BCModel at the index.

Definition at line 74 of file BCModelManager.h.

int BCModelManager::GetNDataPoints ( )
inline

Returns the number of entries in the common data set.

Returns
The number of entries.

Definition at line 80 of file BCModelManager.h.

unsigned int BCModelManager::GetNModels ( )
inline
Returns
The number of models.

Definition at line 67 of file BCModelManager.h.

void BCModelManager::Integrate ( )

Calculates the normalization of the likelihood for each model in the container.

Definition at line 306 of file BCModelManager.cxx.

void BCModelManager::MarginalizeAll ( )

Marginalize all probabilities wrt. single parameters and all combinations of two parameters for all models.

Definition at line 386 of file BCModelManager.cxx.

BCModelManager & BCModelManager::operator= ( const BCModelManager modelmanager)

The defaut assignment operator

Definition at line 46 of file BCModelManager.cxx.

void BCModelManager::PrintModelComparisonSummary ( const char *  filename = 0)

Prints a summary of model comparison into a file. If filename is omitted the summary will be printed onto the screen

Parameters
filenamename of the file to write into.

Definition at line 477 of file BCModelManager.cxx.

void BCModelManager::PrintResults ( )

Prints summaries of all files

Definition at line 553 of file BCModelManager.cxx.

void BCModelManager::PrintSummary ( const char *  filename = 0)

Prints a summary into a file. If filename is omitted the summary will be printed onto the screen. This method is obsolete. Use PrintResults() instead.

Parameters
filenamename of the file to write into.

Definition at line 413 of file BCModelManager.cxx.

int BCModelManager::ReadDataFromFile ( const char *  filename,
const char *  treename,
const char *  branchnames 
)
inline

Reads data from a file. For a description see the following member functions.

Definition at line 214 of file BCModelManager.h.

int BCModelManager::ReadDataFromFileTree ( const char *  filename,
const char *  treename,
const char *  branchnames 
)

Reads tree data from a ROOT file. Opens a ROOT file and gets a ROOT tree. It creates data set containing the values read from the file.

Parameters
filenameThe filename of the ROOT file
treenameThe name of the ROOT tree
branchnamesA vector of the names of the branches
See Also
ReadDataFromFileHist(char * filename, char * histname, const char* branchnames);
ReadDataFromFileTxt(char * filename, int nbranches);

Definition at line 242 of file BCModelManager.cxx.

int BCModelManager::ReadDataFromFileTxt ( const char *  filename,
int  nbranches 
)

Reads data from a txt file. Opens a txt file and creates data set containing the values read from the file.

Parameters
filenameThe filename of the ROOT file
nbranchesThe number of variables
See Also
ReadDataFromFileTree(char * filename, char * treename, std::vector<char*> branchnames)
ReadDataFromFileHist(char * filename, char * histname, const char * branchnames);

Definition at line 274 of file BCModelManager.cxx.

void BCModelManager::ResetDataSet ( )
inline

Resets the data set

Definition at line 268 of file BCModelManager.h.

void BCModelManager::SetAbsolutePrecision ( double  absprecision)

Set absolute precision of the numerical integation

Definition at line 171 of file BCModelManager.cxx.

void BCModelManager::SetDataBoundaries ( int  index,
double  lowerboundary,
double  upperboundary 
)

Set the lower and upper boundaries for possible data values for a particular variable

Definition at line 225 of file BCModelManager.cxx.

void BCModelManager::SetDataPointLowerBoundaries ( BCDataPoint datasetlowerboundaries)

Sets the data point containing the lower boundaries of possible data values

Definition at line 189 of file BCModelManager.cxx.

void BCModelManager::SetDataPointLowerBoundary ( int  index,
double  lowerboundary 
)

Sets the lower boundary of possible data values for a particular variable

Definition at line 207 of file BCModelManager.cxx.

void BCModelManager::SetDataPointUpperBoundaries ( BCDataPoint datasetupperboundaries)

Sets the data point containing the upper boundaries of possible data values

Definition at line 198 of file BCModelManager.cxx.

void BCModelManager::SetDataPointUpperBoundary ( int  index,
double  upperboundary 
)

Sets the upper boundary of possible data values for a particular variable

Definition at line 216 of file BCModelManager.cxx.

void BCModelManager::SetDataSet ( BCDataSet dataset)

Sets the data set common to all BCModels in this BCModelManager.

Parameters
datasetA data set

Definition at line 56 of file BCModelManager.cxx.

void BCModelManager::SetIntegrationMethod ( BCIntegrate::BCIntegrationMethod  method)
Parameters
methodThe integration method

Definition at line 134 of file BCModelManager.cxx.

void BCModelManager::SetMarginalizationMethod ( BCIntegrate::BCMarginalizationMethod  method)
Parameters
methodThe marginalization method

Definition at line 144 of file BCModelManager.cxx.

void BCModelManager::SetNbins ( unsigned int  n)
Parameters
nNumber of bins per dimension for the marginalized distributions. Default is 100. Minimum number allowed is 2.

Definition at line 180 of file BCModelManager.cxx.

void BCModelManager::SetNChains ( unsigned int  n)

Sets the number of Markov chains

Definition at line 233 of file BCModelManager.cxx.

void BCModelManager::SetNIterationsMin ( int  niterations)

Sets the minimum number of iterations for the Monte Carlo integration for all BCModels in this BCModelManager.

Parameters
niterations

Definition at line 112 of file BCModelManager.cxx.

void BCModelManager::SetNIterationsOutput ( int  niterations)
Parameters
niterationsinterval for outputting during integration. If negative, frequency is autogenerated.

Definition at line 126 of file BCModelManager.cxx.

void BCModelManager::SetNIterationsPrecisionCheck ( int  niterations)
Parameters
niterationsinterval for checking precision in integration routines

Definition at line 119 of file BCModelManager.cxx.

void BCModelManager::SetOptimizationMethod ( BCIntegrate::BCOptimizationMethod  method)
Parameters
methodThe mode finding method

Definition at line 153 of file BCModelManager.cxx.

void BCModelManager::SetRelativePrecision ( double  relprecision)
Parameters
relprecisionThe relative precision envisioned for Monte Carlo integration

Definition at line 162 of file BCModelManager.cxx.

void BCModelManager::SetSingleDataPoint ( BCDataPoint datapoint)

Sets a single data point as a common data set.

Parameters
datapointA data point
See Also
SetSingleDataPoint(BCDataSet * dataset, int index)
SetDataSet(BCDataSet * dataset)

Definition at line 68 of file BCModelManager.cxx.

void BCModelManager::SetSingleDataPoint ( BCDataSet dataset,
unsigned int  index 
)

Sets a single data point as a common data set.

Parameters
datasetA data set.
indexThe index of the data point in the data set specified.
See Also
SetSingleDataPoint(BCDataPoint * datapoint)
SetDataSet(BCDataSet * dataset)

Definition at line 82 of file BCModelManager.cxx.

void BCModelManager::WriteMarkovChain ( bool  flag)

Flag for writing Markov chain to file

Definition at line 395 of file BCModelManager.cxx.


The documentation for this class was generated from the following files: