MRS  1.0
A C++ Class Library for Statistical Set Processing
subpavings::MCMCGRAuto::Diagnostic Class Reference

An abstract type to calculate Gelman-Rubin convergence diagnostics for an MCMC process. More...

+ Inheritance diagram for subpavings::MCMCGRAuto::Diagnostic:

List of all members.

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.

Detailed Description

An abstract type to calculate Gelman-Rubin convergence diagnostics for an MCMC process.

Each concrete type must be able to calculate its $ \widehat{R} $ (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 $ \widehat{R} $ values, if this does not then an MCMCGRAuto should not deem that burn-in has been achieved.


Member Function Documentation

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.

Returns:
1 if convergence criteria satisfied, 0 otherwise

Implemented in subpavings::MCMCGRDiagnosticInterval, and subpavings::MCMCGRDiagnosticPSRF.

virtual cxsc::real subpavings::MCMCGRAuto::Diagnostic::getCurrentRhatValue ( ) const [pure virtual]

Get the current estimated R held.

Note:
Used for debugging. *
Returns:
The current estimated R value.
Precondition:
This holds at least one estimated R.

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.

Parameters:
chThe number of chains to initialise for.
chSuggested number of loops to reserve space for: this can choose to reserve more but should not reserve less capacity than this.
logsIndicator 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.

Parameters:
infoObjsThe collection of ChangeOfStateInformationAutoMCMC objects that this can ask to initialise its scalar values for each chain.
Precondition:
infoObjs.size() == chains .

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.

Note:
Used for debugging. Results go to filename returned by getGRWorkingCalcsFilename().

Outputs the intermediary values held and calculations for the the Gelman-Rubin convergence diagnostic calculations.

Parameters:
precDataThe 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.

Note:
Results go to filename returned by getGRDiagnosticsFilename().

Outputs the results of the Gelman-Rubin convergence diagnostic calculations (W, B, estimated variance, estimated R, whether convergence criteria satisfied, and sampledIndPtr values).

Note:
This version used for debugging.
Parameters:
sampledIndPtrA 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.
precDataThe 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.

Note:
Results go to filename returned by getGRDiagnosticsFilename().

Outputs the results of the Gelman-Rubin convergence diagnostic calculations (W, B, estimated variance, estimated R, whether convergence criteria satisfied).

Parameters:
precDataThe 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.

Parameters:
infoObjsThe collection of ChangeOfStateInformationAutoMCMC objects that this can ask for updates to its scalar values for each chain.
Precondition:
infoObjs.size() == chains .

Implemented in subpavings::MCMCGRDiagnosticInterval, and subpavings::MCMCGRDiagnosticPSRF.


The documentation for this class was generated from the following file:
 All Classes Namespaces Functions Variables Typedefs Enumerations Friends