RDP 2023-07: Identification and Inference under Narrative Restrictions Appendix A: Numerical Implementation

This appendix describes a general algorithm to implement the robust Bayesian procedure under NR. GK21 propose numerical algorithms for conducting robust Bayesian inference in SVARs identified using traditional sign and zero restrictions. Their Algorithm 1 uses a numerical optimisation routine to obtain the lower and upper bounds of the identified set at each draw of ϕ. Obtaining the bounds via numerical optimisation may be difficult under the set of NR considered here, since the problem is non-convex. We therefore adapt Algorithm 2 of GK21, which approximates the bounds of the identified set at each draw of ϕ using Monte Carlo simulation.

Algorithm A.1. Let N( ϕ,Q, Y T ) 0 s×1 be the set of NR and let S( ϕ,Q ) 0 s ˜ ×1 be the set of traditional sign restrictions (excluding the sign normalisation). Assume the object of interest is η i,j,h= c i,h ( ϕ ) q j .

  • Step 1: Specify a prior for ϕ, π ϕ , and obtain the posterior π ϕ| Y T .
  • Step 2: Draw ϕ from π ϕ| Y T and check whether 𝒬( ϕ| Y T ,N,S ) is empty using the subroutine below.
    • Step 2.1: Draw an n × n matrix of independent standard normal random variables, Z, and let Z= Q ˜ R be the QR decomposition of Z.[18]
    • Step 2.2: Define

      Q=[ sign( ( Σ tr 1 e 1,n ) q ˜ 1 ) q ˜ 1 q ˜ 1 ,...,sign( ( Σ tr 1 e n,n ) q ˜ n ) q ˜ n q ˜ n ],

      where q ˜ j is the jth column of Q ˜ .

    • Step 2.3: Check whether Q satisfies N( ϕ,Q, Y T ) 0 s×1 and S( ϕ,Q ) 0 s ˜ ×1 . If so, retain Q and proceed to Step 3. Otherwise, repeat Steps 2.1 and 2.2 (up to a maximum of L times) until Q is obtained satisfying the restrictions. If no draws of Q satisfy the restrictions, approximate 𝒬( ϕ| Y T ,N,S ) as being empty and return to Step 2.
  • Step 3: Repeat Steps 2.1–2.3 until K draws of Q are obtained. Let { Q k ,k=1,...,K } be the K draws of Q that satisfy the restrictions and let qj,k be the jth column of Qk. Approximate [ ( ϕ, Y T ),u( ϕ, Y T ) ] by [ min k c i,h ( ϕ ) q j,k , max k c i,h ( ϕ )q , j,k ] .
  • Step 4: Repeat Steps 2–3 M times to obtain [ ( ϕ m , Y T ),u( ϕ m , Y T ) ] for m = 1, ...,M. Approximate the set of posterior means using the sample averages of ( ϕ m , Y T ) and u( ϕ m , Y T ) .
  • Step 5: To obtain an approximation of the smallest robust credible region with credibility α( 0,1 ), define d( η,ϕ, Y T )=max{ | η( ϕ, Y T ) |,| ηu( ϕ, Y T ) | } and let z ^ α ( η ) be the sample α quantile of { d( η, ϕ m , Y T ),m=1,...,M } . An approximated smallest robust credible interval for η i,j,h is an interval centered at arg min η z ^ α ( η ) with radius min η z ^ α ( η ) .

Algorithm 1 approximates [ ( ϕ, Y T ),u( ϕ, Y T ) ] at each draw of ϕ via Monte Carlo simulation. The approximated set will be too narrow given a finite number of draws of Q, but the approximation error will vanish as the number of draws goes to infinity. Montiel Olea and Nesbit (2021) derive bounds on the number of draws required to control approximation error.

The algorithm may be computationally demanding when the restrictions substantially truncate 𝒬( ϕ| Y T ,N,S ) , because many draws of Q may be rejected at each draw of ϕ.[19] However, the same draws of Q can be used to compute ( ϕ, Y T ) and u( ϕ, Y T ) for different objects of interest, which cuts down on computation time. For example, the same draws can be used to compute the impulse responses of all variables to all shocks at all horizons of interest. Other quantities of interest can also be computed, such as impulse responses to ‘unit’ shocks (e.g. Read 2022b), forecast error variance decompositions, elements of A0 or A+, historical decompositions or structural shocks.


This is the algorithm used by Rubio-Ramírez et al (2010) to draw from the uniform distribution over 𝒪( n ) , except that we do not normalise the diagonal elements of R to be positive. This is because we impose a sign normalisation based on the diagonal elements of A 0 = Q Σ tr 1 in Step 2.2. [18]

Read and Zhu (forthcoming) develop more computationally efficient algorithms for obtaining draws of Q from a uniform distribution over the (conditional) identified set given a broad class of identifying restrictions, including NR. [19]