*! version 16.0 18march2021

[VAR-NR] sign_restrict() -- Routine to generate sign-identified credible set for SVAR

Syntax

transmorphic scalar
sign_restrict(struct var_struct scalar VAR, transmorphic scalar S, struct opt_struct scalar opts)

Description

sign_restrict(VAR,S,opts) generates a credible set of
sign-identified SVARs. Its output is an associative array containing VAR
var_struct structures that satisfy the sign restrictions on the IRF
specified in S (more details on this in the help file for
shock_create()).

The sign restrictions algorithm first draws an OLS reduced-form matrix of
coefficients and variance-covariance matrix from the previously estimated VAR
input. Additionally, a random orthonormal matrix Q is drawn. The impact
matrix of effects on the structural shocks is then calculated as the product of
the drawn covariance matrix and Q. The IRF of the VAR with these drawn
elements is calculated and sign restrictions are imposed. If sign restrictions
are satisfied, the draw is retained; otherwise, the draw is discarded, and the
algorithm begins anew. This process repeats until the target number of credible
draws is obtained or too many failures occur prior to a successful draw; both
thresholds are set in the opts structure prior to running
sign_restrict().

Options for sign restriction identification and functioning are set to defaults
when var_nr is run. They are adjusted using
var_nr_options in Stata or using standard
structure.element structure syntax in Mata. Relevant options are outlined
below. Note that options affecting impulse response calculations are naturally
relevant as well, and are outlined in the help file for
irf_funct().

Options

ndraws specifies the target number of successful draws. When
sign_restrict has generated the target number of draws that satisfy
the given sign restrictions, the functions stops. This value should be a
positive integer.

err_lmt specifies the maximum number of failed draws before the first
successful draw that the sign_restrict algorithm should tolerate. If this
threshold is met, the function aborts with an error message. This value should
be a positive integer.

updt indicates whether the sign_restrict function should
periodically update the user on its progress. Options are "yes" or "no". If
"yes", the function will display the number of successful draws and the number
of total draws so far at the interval set by the updt_frqcy option.

updt_frqcy specifies how often the sign_restrict function updates the
user on its progress if updt is set to "yes". After every updt_frqcy
draws, function prints the number of successful draws and the number of total
draws so far. This value should be a positive integer.

Remarks

sign_restrict() can be called in Stata using function
var_nr_sign_restrict.

For an overview of functions in the toolbox, see

[VAR-NR] var_nr Toolbox -- Stata functions and Mata functions.

Sources

Code for this function is adapted from Ambrogio Cesa-Bianchi's VAR Toolbox.
Code follows Kilian and Lutkepohl's notation in
Structural Vector Autoregressive Analysis (2016).