This class is instantiated with one or more MCMCGRAuto::Diagnostic diagnostics objects. Each one calculates its own Gelman-Rubin values and determines whether its own tolerance criteria is met. The MCMCGRAutoNew object organises the MCMC process and determines whether some overall burn-in criteria across all the diagnostics it is using is satisfied (eg, whether some threshold number of diagnostic criteria rhatFlagCounterThreshold has been met). If this overall burn-in criteria is satisfied, this object samples from the chains. When sampling is completed this object returns the sample average. More...
Public Member Functions | |
MCMCGRAutoNew (const std::vector< MCMCGRAuto::Diagnostic * > &diagPtrs, unsigned long int seed=1234) | |
Constructor. | |
size_t | getMaxFlagThreshold () const |
Get the maximum flag threshold that makes sense for this. | |
double | getLastRunTime () const |
Get the time taken, in seconds, for the last successful run. | |
size_t | getFirstBurninTime () const |
Get the state at which burnin is first reached. |
This class is instantiated with one or more MCMCGRAuto::Diagnostic diagnostics objects. Each one calculates its own Gelman-Rubin values and determines whether its own tolerance criteria is met. The MCMCGRAutoNew object organises the MCMC process and determines whether some overall burn-in criteria across all the diagnostics it is using is satisfied (eg, whether some threshold number of diagnostic criteria rhatFlagCounterThreshold has been met). If this overall burn-in criteria is satisfied, this object samples from the chains. When sampling is completed this object returns the sample average.
If rhatFlagCounterThreshold is not specified as an argument to to doMCMCGRAuto(), the default value is the number of diagnostic criteria, ie all have to be 'true' for convergence to be deemed to have taken place.
Objects of this type use a LogCatalan prior and a UniformSSMProposal (stay-split-merge base chain) with probability of staying in the same state for the MCMC routine.
MCMCGRAutoNew::MCMCGRAutoNew | ( | const std::vector< MCMCGRAuto::Diagnostic * > & | diagPtrs, |
unsigned long int | seed = 1234 |
||
) | [explicit] |
Constructor.
The constructor uses seed to initialise a prng to generate random seeds to be used for the doMCMCGRAuto process.
The number of post-burnin samples monitored using the convergence diagnostics if NORMAL sampling is used (i.e., burnin once) is set to some small default value. This just means that output from the diagnostics that can be used to make trace plots extends a little way past the point where burnin is diagnosed.
diagObj | The Gelman-Rubin convergence diagnostic object. |
seed | seed to use for a pseudo random number generator (defaults to 1234). |
: diagObjPtrs(diagPtrs), rgsl(NULL), time(0.0), burntinReachedState(0) { try { rgsl = gsl_rng_alloc (gsl_rng_mt19937); gsl_rng_set(rgsl, seed); } catch (...) { try { if (NULL != rgsl) { gsl_rng_free(rgsl); rgsl = NULL; } } catch (...) {} // catch and swallow throw; } }
size_t MCMCGRAutoNew::getFirstBurninTime | ( | ) | const [virtual] |
Get the state at which burnin is first reached.
If the sampling type is CAUTIOUS, this will be the state at which the last successful attempt at burnin was reached.
Implements subpavings::MCMCGRAuto.
{
return burntinReachedState;
}
double MCMCGRAutoNew::getLastRunTime | ( | ) | const [virtual] |
Get the time taken, in seconds, for the last successful run.
If the last run was not successful, the value returned by this method will not necessarily record the time taken for that last run.
Implements subpavings::MCMCGRAuto.
{
return time;
}