BIE::Simulation Class Reference

Base class for an MCMC simulation. More...

#include <Simulation.h>

Inheritance diagram for BIE::Simulation:
Collaboration diagram for BIE::Simulation:

List of all members.

Public Member Functions

virtual ~Simulation ()
 Force runtime binding of inherited destructor.
virtual void Reinitialize (MHWidth *width, MixturePrior *p)
 Reinitialize Metropolis Hastings proposal width and Prior.
void OneStep ()
 Take one MCMC step.
ConvergegetConverge () const
 Convergence method.
bool Convergence ()
 Uses provided convergence method to indicate completion.
int BurnIn ()
 Indicate state index beyond which chain is converged.
void NewConvergence (int m, Ensemble *d, string id)
 Construct new instance of convergence for new level.
State Prior ()
 Generate a state from current prior.
virtual double Likelihood (State &, int indx)
 Determine likelihood for current state.
double PriorValue (State &)
 Determine prior value for current state.
virtual State GetState ()
 Return current state.
virtual void PrintStepDiagnostic ()
 Print diagnostic information at end of step.
virtual void PrintStateDiagnostic ()
 Print diagnostic information about each state Intended to be overridden to provide information that is simulation specific.
virtual double GetValue ()
 Return current posterior probability value.
virtual double GetPrior ()
 Return current prior value.
virtual double GetLikelihood ()
 Return current likelihood probability value.
void SetThreshold (double v)
 Set per bin data threshold for rejecting a state as inconsistent.
void SetUserLikelihood (LikelihoodFunction *fct)
 Set a user-defined likelihood function.
SimulationGetPreviousSimulation ()
 Get prior simulation instance.
void ResetFrontier ()
 Reset current frontier to default.
void SetPriorFrontier (Frontier *f)
 Set frontier for prior level.
int GetMmax ()
 Maximum number of mixture components.
int GetMcur ()
 Get the number of components in the fiducial chain.
int GetNdim ()
 Model dimension.
BaseDataTreeGetDataTree ()
 Get DataTree for this Simulation.
LikelihoodComputationGetLike ()
 Get LikelihoodComputation for this Simulation.
MCAlgorithmGetMCA ()
 Get Monte Carlo Algorithm for this Simulation.
MixturePriorGetMixturePrior ()
 Get Prior for this Simulation.
MHWidthGetMHWidth ()
 Get Metropolis-Hastings width for this Simulation.
FrontiercurrentFrontier ()
 Get current frontier pointer.
FrontierpriorFrontier ()
 Get prior frontier pointer.
virtual void AdditionalInfo ()
 Print out simulation specific diagnostics.
void DebugState (string s)
 Enable state debugging for examining multilevel likelihood ratios.
 Simulation (int M, int Ndim, MHWidth *mhwidth, BaseDataTree *d, Model *m, Integration *i, Converge *c, MixturePrior *p, LikelihoodComputation *l, MCAlgorithm *mca, Simulation *last=NULL)
 Constructor: All subordinate "helper" classes are provided at instantiation.
 Simulation (int M, int Ndim, BaseDataTree *d, Model *m, Integration *i, Converge *c, MixturePrior *p, LikelihoodComputation *l, MCAlgorithm *mca, Simulation *last=NULL)
 Constructor without a Metropolis-Hastings width (initial version).
bool AccumConverge (double value, State &state)
 Accumulate states for testing convergence.
bool AccumConverge (vector< double > &values, vector< State > &states)
virtual void ReportState (State &s)
 Print passed state in ascii with labels.
virtual void ReportState ()
virtual void LogState (string &logfile)
 Add state to log file.
virtual void LogState (int level, int iterno, string &outfile)
virtual void NewState (int Mcur, vector< double > &w, vector< vector< double > > &p)
 Initialize new state.
virtual void NewState (Chain &ch)
virtual void NewState (State &s)
State Mix_to_State (int Mcur, vector< double > &w, vector< vector< double > > &p)
 Utility functions.
void State_to_Mix (int &Mcur, vector< double > &w, vector< vector< double > > &p, State &s)
virtual void PrintState ()
bool Serial ()
bool Parallel ()

Public Attributes

LikelihoodFunctionLP
 Function to return the probability for a distribution of a particular type given the prediction and sample distribution.

Static Public Attributes

static unsigned int state_diag
 Number of states to accumulate before printing diagnostic messages.
static unsigned int output_prec
 Output precision for logging state data.

Protected Member Functions

virtual void MCMethod ()
 MCMC method to be defined by the implementing class.
void print_bin_frequency (void)
 Print occupation numbers in each tile (for debugging).
double BinnedLikeProb (vector< double > &z, SampleDistribution *sd, double norm, Tile *t, State *s)
 Use log Poisson probability to compute the joint probability for each bin given the data in the BinnedDistribution (passed as a SampleDistribution).
double PointLikeProb (vector< double > &z, SampleDistribution *sd, double norm, Tile *t, State *s)
 Use log probabiilty for each point.

Protected Attributes

bool first_log
 True if no states have been logged.
int M
 Number of components in the mixture.
int Ndim
 Dimension of each mixture ocmponent.
MHWidth_mhwidth
 The Metropolis-Hastings width.
Simulation_last
 The last simulation.
BaseDataTree_dist
 The data.
Integration_intgr
 The integraton over the x-y area.
MixturePrior_prior
 The prior distribution.
Model_model
 The theoretical/hypothetical model.
Converge_conv
 The definition of the convergence algorithm.
LikelihoodComputation_likelihoodComputation
 The likelihood evaluation computation strategy.
MCAlgorithm_mca
 The Markov Chain algorithm.
Frontier_currentFrontier
 The current frontier in the DataTree.
Frontier_priorFrontier
 The previous frontier in the DataTree.
bool internalLP
 Flags whether or not internal default likelhood functions or user a user-defined likelihood function is used.
bool serialLP
 Flags parallel or serial likelihood computation.
bool state_not_initialized
 Is there a valid state?
int nbad
 Tally rejected states.
int ngood
 Tally good states.
double threshval
 Default per bin trim (default: 0).
bool debug_state
 State logging for debugging.
string debug_tag
 File for debug output.
int debug_cnt
 Counter for number of debug calls.
string algoname
 Algorithm name.
Chain ch
 Chain state variables.
Chainchfid
vector< Chainchains
 List of chains.
int Mchains
 Number of chains.

Friends

class LikelihoodComputation
class MCAlgorithm
class MetropolisHastings
class ReversibleJump
class boost::serialization::access


Detailed Description

Base class for an MCMC simulation.

This simulation can be run; it simply invokes the MCMC algorithm for a single update step.


Constructor & Destructor Documentation

BIE::Simulation::Simulation ( int  M,
int  Ndim,
MHWidth mhwidth,
BaseDataTree d,
Model m,
Integration i,
Converge c,
MixturePrior p,
LikelihoodComputation l,
MCAlgorithm mca,
Simulation last = NULL 
)

Constructor: All subordinate "helper" classes are provided at instantiation.

Parameters:
M is the number of mixture components
Ndim is the parameter dimension of each component
mhwidth is the instance of the Metropolis-Hastings proposal class for this simulation
d is the DataTree for this simulation which defines both the input data and defines the mapping of the coordinate plane for data binning
m defines the underlying model family (class Model) whose parameters will be estimate by MCMC
i is the integration algorithm (class Integration) for integrating over the tile for the current Tessellation instance in Base DataTree
c is the instance of class Converge that provides the test for MCMC convergence (that is,are we done simulating yet?)
p defines the prior for a mixture model (class MixturePrior)
l defines the LikelihoodComputation algorithm
mca is the Markov Chain algorithm
last is the previous Simulation used to perform the Bayesian update if non-null (
See also:
multi) Constructor with Metropolis-Hastings (initial version) Constructor with Metropolis-Hastings (multiple-level version)

BIE::Simulation::Simulation ( int  M,
int  Ndim,
BaseDataTree d,
Model m,
Integration i,
Converge c,
MixturePrior p,
LikelihoodComputation l,
MCAlgorithm mca,
Simulation last = NULL 
)

Constructor without a Metropolis-Hastings width (initial version).

Constructor without a Metropolis-Hastings width (multiple-level version)


Member Function Documentation

virtual void BIE::Simulation::PrintStepDiagnostic (  )  [virtual]

Print diagnostic information at end of step.

Intended to be overridden to provide information that is simulation specific

Reimplemented in BIE::DifferentialEvolution, BIE::MultipleChains, BIE::ParallelChains, BIE::TemperedDifferentialEvolution, and BIE::TemperedSimulation.


Member Data Documentation

bool BIE::Simulation::serialLP [protected]

Flags parallel or serial likelihood computation.

Serial computation (true) computes priors, parallel computation (false) skips prior computation

Chain state variables.

Single chains

Function to return the probability for a distribution of a particular type given the prediction and sample distribution.

Tile and State points are passed for diagnostics but are not needed to compute the probability.


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

Send suggestions, questions, and feedback to WEINBERG at ASTRO dot UMASS dot EDU.
Documentation generated at Fri Mar 26 00:35:13 2010 by doxygen