An abstract type to calculate Gelman-Rubin convergence diagnostics for an MCMC process. More...
Public Member Functions | |
virtual | ~Diagnostic () |
Destructor. | |
virtual bool | isRequired () const =0 |
Get whether this diagnostic is required for burn-in. | |
virtual void | clean ()=0 |
Clean old calculations out. | |
virtual void | initialise (size_t ch, size_t res, bool logs=false)=0 |
Clean old calculations out and initialise for new calculations. | |
virtual void | initialiseChainValues (const std::vector< ChangeOfStateInformationAutoMCMC > &infoObjs)=0 |
Initialise values for each chain. | |
virtual void | updateChainValuesInLoop (const std::vector< ChangeOfStateInformationAutoMCMC > &infoObjs)=0 |
Update calculations for each chain. | |
virtual int | calcDiagnosticsForLoop ()=0 |
Do convergence diagnostic calculations for a loop or iteration of the MCMC process, ie using current values assuming all chains have been iterated through for this loop. | |
virtual void | outputResults (const std::string &filenameGRScalars, const RealVec &sampledInd, int precData=5) const =0 |
Output results including the contents of sampledIndPtr. | |
virtual void | outputResults (const std::string &filenameGRScalars, int precData=5) const =0 |
Output results. | |
virtual void | outputCalculations (const std::string &filenameGRWorkingCalcs, int precData=5) const =0 |
Output values used in the calculations. | |
virtual const std::vector < std::vector< cxsc::real > > & | getScalarsRef () const =0 |
Get a const reference to the scalars held by this. | |
virtual cxsc::real | getCurrentRhatValue () const =0 |
Get the current estimated R held. | |
virtual std::string | getGRWorkingCalcsFilename () const =0 |
Get the name used by this in output files for working calculations. | |
virtual std::string | getGRDiagnosticsFilename () const =0 |
Get the name used by this in results files. | |
virtual std::string | getScalarsName () const =0 |
Get the name used by this for the scalar type it is using. | |
virtual cxsc::real | getTolerance () const =0 |
Get the tolerance used by this. |
An abstract type to calculate Gelman-Rubin convergence diagnostics for an MCMC process.
Each concrete type must be able to calculate its (from within-chain and between chain variances) and report whether this is within a specified tolerance of 1.0. Each concrete type may also be configured as required for burn-in or not.
Required for burn-in is used by objects assessing burn-in over a variety of diagnostics. Requried for burn-in indicates that even if other diagnostics have satisfactory values, if this does not then an MCMCGRAuto should not deem that burn-in has been achieved.
virtual int subpavings::MCMCGRAuto::Diagnostic::calcDiagnosticsForLoop | ( | ) | [pure virtual] |
Do convergence diagnostic calculations for a loop or iteration of the MCMC process, ie using current values assuming all chains have been iterated through for this loop.
Implemented in subpavings::MCMCGRDiagnosticInterval, and subpavings::MCMCGRDiagnosticPSRF.
virtual cxsc::real subpavings::MCMCGRAuto::Diagnostic::getCurrentRhatValue | ( | ) | const [pure virtual] |
Get the current estimated R held.
Implemented in subpavings::MCMCGRDiagnosticInterval, and subpavings::MCMCGRDiagnosticPSRF.
virtual void subpavings::MCMCGRAuto::Diagnostic::initialise | ( | size_t | ch, |
size_t | res, | ||
bool | logs = false |
||
) | [pure virtual] |
Clean old calculations out and initialise for new calculations.
ch | The number of chains to initialise for. |
ch | Suggested number of loops to reserve space for: this can choose to reserve more but should not reserve less capacity than this. |
logs | Indicator for whether this is to keep additional logs for calculations. |
Implemented in subpavings::MCMCGRDiagnosticInterval, and subpavings::MCMCGRDiagnosticPSRF.
virtual void subpavings::MCMCGRAuto::Diagnostic::initialiseChainValues | ( | const std::vector< ChangeOfStateInformationAutoMCMC > & | infoObjs | ) | [pure virtual] |
Initialise values for each chain.
infoObjs | The collection of ChangeOfStateInformationAutoMCMC objects that this can ask to initialise its scalar values for each chain. |
Implemented in subpavings::MCMCGRDiagnosticInterval, and subpavings::MCMCGRDiagnosticPSRF.
virtual void subpavings::MCMCGRAuto::Diagnostic::outputCalculations | ( | const std::string & | filenameGRWorkingCalcs, |
int | precData = 5 |
||
) | const [pure virtual] |
Output values used in the calculations.
Outputs the intermediary values held and calculations for the the Gelman-Rubin convergence diagnostic calculations.
precData | The precision for the output. |
Implemented in subpavings::MCMCGRDiagnosticInterval, and subpavings::MCMCGRDiagnosticPSRF.
virtual void subpavings::MCMCGRAuto::Diagnostic::outputResults | ( | const std::string & | filenameGRScalars, |
const RealVec & | sampledInd, | ||
int | precData = 5 |
||
) | const [pure virtual] |
Output results including the contents of sampledIndPtr.
Outputs the results of the Gelman-Rubin convergence diagnostic calculations (W, B, estimated variance, estimated R, whether convergence criteria satisfied, and sampledIndPtr values).
sampledIndPtr | A pointer to a collection of values, each one corresponding to a state for which this holds calcuations, indicating whether sampling took place in that state. |
precData | The precision for the output. |
Implemented in subpavings::MCMCGRDiagnosticInterval, and subpavings::MCMCGRDiagnosticPSRF.
virtual void subpavings::MCMCGRAuto::Diagnostic::outputResults | ( | const std::string & | filenameGRScalars, |
int | precData = 5 |
||
) | const [pure virtual] |
Output results.
Outputs the results of the Gelman-Rubin convergence diagnostic calculations (W, B, estimated variance, estimated R, whether convergence criteria satisfied).
precData | The precision for the output. |
Implemented in subpavings::MCMCGRDiagnosticInterval, and subpavings::MCMCGRDiagnosticPSRF.
virtual void subpavings::MCMCGRAuto::Diagnostic::updateChainValuesInLoop | ( | const std::vector< ChangeOfStateInformationAutoMCMC > & | infoObjs | ) | [pure virtual] |
Update calculations for each chain.
infoObjs | The collection of ChangeOfStateInformationAutoMCMC objects that this can ask for updates to its scalar values for each chain. |
Implemented in subpavings::MCMCGRDiagnosticInterval, and subpavings::MCMCGRDiagnosticPSRF.