Skip to content

[IrisToolbox] for Macroeconomic Modeling

Adaptive Random-Walk Metropolis (ARWM) Posterior Simulator

jaromir.benes@iris-toolbox.com


Initialization

Initial vector of parameters \(\theta_0\) poster.InitParam

Initial proposal covariance matrix \(\Sigma_0\) poster.InitProposalCov

Initial scale \(\sigma_0\) poster.InitScale=1/3

Factorize \(\Sigma_0 = P_0 P_0'\)


Burn-in

Run a total \(N_\mathrm{burn} + N\)

Return \(N\)

Discard \(N_\mathrm{burn}\)

Parameter Range IrisT default
\(N_\mathrm{burn}\) \((0, 1)\) burnIn=0.10

Next proposal

\[ \hat \theta_n = \theta_{n-1} + w_n = \theta_{n-1} + \sigma_{n-1} \, P_{n-1} \, u_n \]
\[ \begin{gathered} w_n \sim N(0, \, \sigma_{n-1}^2 \Sigma_{n-1}) \\[10pt] u_n \sim N(0, 1) \end{gathered} \]

Acceptance or rejection

Accept \(\hat \theta_n\) with probability \(\alpha_n\)

\[ \alpha_n = \min \left\{ 1, \frac{\mathit{poster}\,(\hat\theta_n)}{\mathit{poster}\,(\theta_{n-1})} \right\} \]

If accepted (\(a_n=1\)): \(\theta_n = \hat \theta_n\)

If rejected (\(a_n=0\)): \(\theta_n = \theta_{n-1}\)


Adaptation to target acceptance ratio

Adapt the scale and shape of the proposal covariance matrix to force acceptance ratio towards target \(\alpha^*\)

Adaptation

\[ \propto \begin{cases} n^{-\gamma} \left( \alpha_n - \alpha^* \right) & \text{if} \quad n\le \overline n_\mathrm{adapt} \\ 0 & \text{if} \quad n> \overline n_\mathrm{adapt} \end{cases} \\[10pt] \]
Parameter Range IrisT default
\(\gamma\) \((0.5, 1)\) gamma=0.8
\(\overline n_\mathrm{adapt}\) \(\{2, 3, 4, \dots\}\) lastAdapt=Inf

Adaptation needs to be vanishing to preserve ergodicity


Scale adaptation

For \(n \le \overline n_\mathrm{adapt}:\)

\[ \log \sigma_n = \log \sigma_{n-1} + \kappa_\mathrm{scale} \, n^{-\gamma} \left(\alpha_n - \alpha^*\right) \]
Parameter Range IrisT default
\(\kappa_\mathrm{scale}\) \((0, \infty)\) adaptScale=1

Shape adaptation

For \(n \le \overline n_\mathrm{adapt}\):

\[ \Sigma_n = P_n P_n' = P_{n-1} \left[ I + \kappa_\mathrm{shape} n^{-\gamma} \left(\alpha_n - \alpha^*\right) \frac{u_n u_n'}{\|u_n\|^2} \right] P_{n-1}' \]
Parameter Range IrisT default
\(\kappa_\mathrm{shape}\) \((0, \infty)\) adaptShape=0.5

Output arguments for diagnostics

Chain of log posteriors \(\mathit{poster}\left(\theta_n\right)\)

Cumulative acceptance ratio \(\textstyle\sum_{k=1}^{n} a_k /n\)

Chain of scale factors \(\sigma_n\)

Final proposal covariance matrix \(\Sigma_N\)