Posterior Sampling Convergence Criteria¶
Class providing convergence criteria for Bayesian posterior sampling simulations—diagnostics that assess whether the Markov chains have adequately explored the posterior distribution and can be declared converged. Methods return whether convergence has been reached (and at which step), reset the convergence calculation when chains are restarted, log convergence diagnostics to file, and identify outlier chains. The default implementation uses the Gelman-Rubin \(\hat{R}\) statistic, which compares within-chain and between-chain variances across all active walkers.
Default implementation: posteriorSampleConvergenceGelmanRubin
Methods¶
isConverged→logicalReturns true if the posterior sampling is deemed to be converged.
class (posteriorSampleStateClass), intent(inout), optional :: simulationStatedouble precision , intent(in ), optional :: logLikelihood
convergedAtStep→integerReturns the simulation step index at which the posterior sampling was first declared converged, or a negative value if convergence has not yet been reached.
reset→voidReset the convergence diagnostic to its initial state, clearing any accumulated chain statistics, typically called when the sampler is restarted or the chain population is reinitialized.
logReport→voidWrite a human-readable report of the current convergence state (e.g.the \(\hat{R}\) statistic and per-parameter values) to the open file unit
fileUnit.integer, intent(in ) :: fileUnit
stateIsOutlier→logicalReturn true if the specified state is deemed to be an outlier.
integer, intent(in ) :: stateIndex
posteriorSampleConvergenceAlways¶
A posterior sampling convergence class which is always converged.
posteriorSampleConvergenceGelmanRubin¶
This class adopts the convergence criterion proposed by Gelman and Rubin (1992; see also Brooks and Gelman 1998), which compares the variance in parameter values within chains to that between chains. Outlier detection is applied to the chains using a standard Grubb’s outlier test. The behavior of this criterion is controlled by the following subparameters:
RhatThe correlation coefficient, \(\hat{R}\), value at which to declare convergence.
burnCountSet number of steps to burn before applying the convergence test.
testCountSet the number of steps between successive applications of the convergence test.
outlierSignificanceThe significance level required in outlier detection.
outlierLogLikelihoodOffsetThe offset in log-likelihood from the current maximum likelihood chain required for a chain to be declared to be an outlier.
outlierCountMaximumThe maximum number of outlier chains allowed.
(Default implementation)
Methods
convergenceMeasure— Return the current convergence measure, \(\hat{R}\).convergenceMeasureTarget— Return the target convergence measure, \(\hat{R}\).
Parameters
[thresholdHatR](default1.2d0) — The Gelman-Rubin potential scale reduction factor \(\hat{R}\) threshold below which all parameters must fall for the chains to be declared converged; values close to 1.0 indicate convergence, with 1.2 being a common default.[burnCount](default0) — The number of initial MCMC steps to discard as burn-in before beginning to accumulate chain history for the Gelman-Rubin \(\hat{R}\) convergence test.[testCount](default10) — The interval in number of steps at which to check convergence.[outlierCountMaximum](default0) — The maximum number of chains whose current state may be identified as statistical outliers when computing the convergence statistic.[outlierSignificance](default0.05d0) — The statistical significance level used when testing whether a chain’s current log-likelihood deviates sufficiently from the ensemble mean to be classified as an outlier chain.[outlierLogLikelihoodOffset](default0.0d0) — The log-likelihood offset at which to declare a state an outlier.[reportCount](default10) — The interval in number of steps at which to report on convergence status.[logFileName]— The name of the file to which convergence state should be logged.
posteriorSampleConvergenceLikelihoodThreshold¶
A posterior sampling convergence class which declares convergence once all likelihoods are above a threshold.
Parameters
[likelihoodThreshold](default0.0d0) — The threshold log-likelihood above which convergence is declared.
posteriorSampleConvergenceNever¶
This option assumes that the simulation never converges, and so the calculation will run indefinitely. It is intended primarily for testing purposes.
posteriorSampleConvergenceStepCount¶
A posterior sampling convergence class which declares convergence after a fixed number of steps.
Parameters
[countSteps]— The number of steps after which to declare the simulation as converged.[stopAfterCount]— The number of steps to continue after convergence before stopping.