Egglib 2.1.11
C++ library reference manual
Public Types | Public Member Functions | List of all members
ABC Class Reference

Model estimation by Approximate Bayesian Computation. More...

#include <ABC.hpp>

Public Types

enum  TransformMode { NONE, LOG, TAN }
 Modes for parameter transformation.
 

Public Member Functions

 ABC ()
 Constructor.
 
 ~ABC ()
 Destructor.
 
void number_of_statistics (unsigned int ns)
 Sets number of statistics. More...
 
void add_fname (const char *fname, unsigned int number_of_params)
 Adds a file name.
 
unsigned int number_of_samples () const
 Gets number of imported data samples.
 
void get_threshold (double tolerance)
 Gets regression threshold. More...
 
double sd (unsigned int index) const
 Gets a standard deviation. More...
 
void obs (unsigned int index, double value)
 Sets a summary statistics. More...
 
unsigned int rejection (const char *outfname, bool exportlabels=false)
 Performs rejection step. More...
 
unsigned int regression (const char *infname, const char *outfname, TransformMode mode, const char *header="")
 Performs regression step. More...
 
double threshold () const
 Gets Euclidean threshold.
 

Detailed Description

Model estimation by Approximate Bayesian Computation.

It is required to set the number of statistics and at least one input file name before performing analysis. The analysis itself consists in several steps. (1) Computation of the threshold, which requires to read through all files and imports statistics. In the process, the standard deviation of all statistics will be calculated and will be available. (2) Computation of Euclidean distances and weights and generation of a second sample file with weights and (non-standardized) statistics with only non-null weights exported. This step requires that the observed statistics have been set (between steps 1 and 2). (3) Local-linear regression using the fit method. While in the previous steps several models can be mixed, in this step a single model can be processed at a time. The output is a simple file with adjusted parameters only.

Member Function Documentation

void get_threshold ( double  tolerance)

Gets regression threshold.

If several files are loaded, the data will be aggregated (note that they must all contain the same number of statistics). At least one file must have been set, and the number of statistics must have been set as well.

Parameters
tolerancerejection threshold (proportion of points in the local region.
void number_of_statistics ( unsigned int  ns)

Sets number of statistics.

If data was already present in the instance, it will all be cleared.

void obs ( unsigned int  index,
double  value 
)

Sets a summary statistics.

The number of statistics must have been set, and the index must not be out of bound.

unsigned int regression ( const char *  infname,
const char *  outfname,
TransformMode  mode,
const char *  header = "" 
)

Performs regression step.

Parameters
infnameinput file name (generated using rejection)
outfnameoutput file name (final posterior)
modetransformation mode
headeroutfile file header (name of parameters; if empty string, no header is printed)
Returns
Number of data point processed
unsigned int rejection ( const char *  outfname,
bool  exportlabels = false 
)

Performs rejection step.

The observed value must have been entered (otherwise the results will be meaningless), and the threshold must have been computed.

Parameters
outfnamethe name of the intermediary file.
exportlabelsif true: exports a tag at the beginning of each line to identify the file or origin of each accepted sample (starting from 1).
Returns
the number of points in the local region.
double sd ( unsigned int  index) const

Gets a standard deviation.

The threshold() method must have been called, and the index must not be out of bound.


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

Hosted by 
Get EggLib at SourceForge.net. Fast, secure and Free Open Source software downloads