BVARResult._stack_of#
- BVARResult._stack_of(beta)[source]#
Slice one
(w, k)coefficient matrix into its(p, k, k)lag stack.The inverse of the design layout: rows
n_det + (l - 1) * kthroughn_det + l * k - 1ofbetaare the lag-lblock, and each is transposed so that slicel - 1is \(A_l\) with[i, j]the response of equationito variablej. Applied tobeta_meanit reproducescoefficients; applied to a draw it gives that draw’s lag stack, which is what_irf_draws(),forecast_paths(), andstable_sharehand tocompanion_matrix()or iterate directly. The deterministic rows are dropped, not returned; callers that need them slicebeta[:n_det]themselves.- Parameters:
beta (
NDArray[double]) – A(w, k)coefficient matrix in design-row order –beta_meanor one slice ofbeta_draws.- Return type:
- Returns:
A
(p, k, k)array;(0, k, k)whenorderis zero.
Example
>>> import numpy as np >>> from cultivars.multivariate.large_dim.bayesian import BVAR >>> y = np.random.default_rng(0).standard_normal((60, 3)) >>> res = BVAR(y, order=2, trend="ct").fit(n_draws=10, seed=0) >>> np.allclose(res._stack_of(res.beta_mean), res.coefficients) True >>> res._stack_of(res.beta_draws[0]).shape (2, 3, 3)