|
CMP++: Uncertainty Quantification & Bayesian Calibration
|
Classes | |
| class | EvolutionaryMarkovChain |
| Implements an Evolutionary Markov Chain Monte Carlo sampler. More... | |
| class | HamiltonianMarkovChain |
| Implements the Hamiltonian Monte Carlo (HMC) algorithm with the No-U-Turn Sampler (NUTS) and Dual Averaging. More... | |
| class | MarkovChain |
| Represents a single Markov Chain utilizing Delayed Rejection Adaptive Metropolis (DRAM) for sampling. More... | |
Functions | |
| double | log1m (double a) |
| template<typename ProposalType > | |
| double | multiChainDiagnosis (const std::vector< MarkovChain< ProposalType > > &chains) |
| Computes the Gelman-Rubin convergence diagnostic metric (R-hat). | |
|
inline |
| double cmp::mcmc::multiChainDiagnosis | ( | const std::vector< MarkovChain< ProposalType > > & | chains | ) |
Computes the Gelman-Rubin convergence diagnostic metric (R-hat).
Mathematical Formulation For \(M\) chains of length \(N\), it computes within-chain variance \(W\) and between-chain variance \(B\):
\[ W = \frac{1}{M} \sum_{m=1}^M s_m^2, \quad B = \frac{N}{M-1} \sum_{m=1}^M (\bar{\theta}_{m} - \bar{\theta}_{\cdot})^2 \]
The posterior marginal variance is estimated as:
\[ \widehat{\text{Var}}(\theta \mid y) = \frac{N-1}{N} W + \frac{1}{N} B \]
The potential scale reduction factor (PSRF or \(\hat{R}\)) is:
\[ \hat{R} = \sqrt{\frac{\widehat{\text{Var}}(\theta \mid y)}{W}} \]
An \(\hat{R} \to 1.0\) indicates successful convergence.
Implementation Algorithm Computes coordinate-wise mean and variance vectors across all active chains, calculates the within-chain and between-chain variances, and returns the maximum coordinate value of \(\hat{R}\).