SignRestrictedSVARResult#
- class cultivars.multivariate.structural.sign_restrictions.SignRestrictedSVARResult(*, source, impacts, shock_names, horizons, restriction, requested, attempts)[source]
Bases:
_SummaryMixinThe accepted set of a sign-restricted identification.
Not a point estimate wearing bands. Every accepted impact matrix \(B_n = L Q_n\) is a complete structural model: \(Q_n\) is orthogonal, so \(B_n B_n' = \Sigma_u\) holds for each, and every declared sign holds at every declared lead. The object holds all of them. The quantile surfaces are summaries of that set, computed pointwise across rotations, and the summary says what that means rather than letting the median band read as a model.
Note
The rotations are drawn uniformly (Haar) over the orthogonal group and kept or discarded, so the accepted set carries the uniform prior over rotations whether or not anyone meant to impose one – the Baumeister-Hamilton critique. A pointwise quantile can come from a different rotation at each horizon, so no single structural model traces a band – the Fry-Pagan critique. The exact endpoints of the set, free of both, are
SetIdentifiedSVAR’s business; the bands here typically cover well under half of the exact range.- Variables:
source – The reduced-form result the rotations factorize.
impacts –
(n_accepted, k, k)accepted impact matrices.shock_names – One label per column; restricted shocks first, in the order they were declared.
horizons – The leads at which the sign restrictions were imposed.
restriction – The declared signs, as a sentence.
requested – Accepted draws asked for.
attempts – Rotations actually drawn.
See also
SignRestrictedSVAR,NarrativeSignRestrictedSVAR– the models whoseidentify()returns this record.SetIdentifiedSVARResult– the exact bounds of the same set, for one restricted shock.
References
Uhlig, H. (2005). What are the effects of monetary policy on output? Results from an agnostic identification procedure. Journal of Monetary Economics, 52(2), 381-419.
Fry, R., & Pagan, A. (2011). Sign restrictions in structural vector autoregressions: A critical review. Journal of Economic Literature, 49(4), 938-960.
Baumeister, C., & Hamilton, J. D. (2015). Sign restrictions, structural vector autoregressions, and useful prior information. Econometrica, 83(5), 1963-1999.
Example
A demand shock declared to raise both variables on impact. Every accepted impact matrix factorizes the innovation covariance and satisfies the signs; the acceptance rate reads how binding they are:
>>> import numpy as np >>> from cultivars.multivariate.reduced_form.vector_autoregression import VAR >>> rng = np.random.default_rng(0) >>> B = np.array([[1.0, 0.5], [0.3, 1.0]]) >>> A = np.array([[0.5, 0.1], [0.0, 0.4]]) >>> eps = rng.standard_normal((402, 2)) >>> y = np.zeros((402, 2)) >>> for t in range(1, 402): ... y[t] = A @ y[t - 1] + B @ eps[t] >>> res = VAR(y, order=1, names=("gdp", "infl")).fit() >>> signs = {"demand": {"gdp": "+", "infl": "+"}} >>> sset = SignRestrictedSVAR(res, signs, draws=500, seed=0).identify() >>> sset.shock_names, sset.horizons, sset.n_accepted, sset.attempts (('demand', 'unrestricted1'), (0,), 500, 671) >>> sset.impacts.shape, round(sset.acceptance_rate, 3) ((500, 2, 2), 0.745) >>> bool(np.allclose(np.einsum("nij,nkj->nik", sset.impacts, sset.impacts), res.sigma_u)) True >>> bool(np.all(sset.impacts[:, :, 0] > 0.0)) True >>> sset.irf(0)[[0, 2], 0, :, 0].round(3).tolist() [[0.383, 0.413], [1.102, 1.024]]
Private methods#
Structured summary rendered by every display path. |