5. Panel VAR Modeling

(Panel reduced-form VAR – the modern factory is prfvar_model, which extends the reduced-form VAR object to a cross-section of units.)

A prfvar_model object models a panel of (possibly Markov-switching) reduced-form VARs: the same set of variables observed for several cross-sectional units (countries, sectors, …), stacked into one system whose coefficients are linked across units by a panel estimator. It is a reduced-form VAR on the stacked variables, so data handling, estimation, identification, forecasting and the various decompositions are exactly as in Reduced-form VAR Modeling; this page covers what is specific to the panel case.

5.1. The model

Stacking the \(n\) units gives

\[\begin{split}\left[ \begin{array}{c} y_{1t} \\ y_{2t} \\ \vdots \\ y_{nt} \end{array} \right] = C(r_{t}) \left[ \begin{array}{c} x_{1t} \\ x_{2t} \\ \vdots \\ x_{nt} \end{array} \right] + B_{1}(r_{t}) \left[ \begin{array}{c} y_{1t-1} \\ y_{2t-1} \\ \vdots \\ y_{nt-1} \end{array} \right] + \cdots + B_{p}(r_{t}) \left[ \begin{array}{c} y_{1t-p} \\ y_{2t-p} \\ \vdots \\ y_{nt-p} \end{array} \right] + u_{t}\end{split}\]

with \(r_{t} = 1, 2, \dots, h\) and transition probabilities \(p_{r_{t}, r_{t+1}}(I_{t})\). The blocks \(B_{1}, \dots, B_{p}\) (dynamic / lag coefficients) and \(C\) (constants and deterministic coefficients) carry, on and off the diagonal, both within-unit and cross-unit dynamics. How much of this is shared across units is the panel estimator (below). The residuals \(u_{t}\) are correlated within and across units.

5.2. Creating a panel VAR

The first argument is the list of units (at least two), the second the variables; the rest of the signature is the rfvar_model one:

units = {'US','CA','MX','BR'};

endog = {'GROWTH','PAI','R'};

mdl = prfvar_model(units, endog, ...
    'lag_length'   , 4, ...
    'constant_term', true);

You declare the variables once and the units once; RISE stacks them into a VAR on the variables <unit>_<var>: US_GROWTH, US_PAI, US_R, CA_GROWTH, … Everything downstream uses these names:

  • the database passed to estimate carries one series per unit and variable under them (db.US_GROWTH, db.CA_GROWTH, …);

  • the coefficients are named as in any reduced-form VAR: b1_US_R_CA_PAI is the coefficient of CA_PAI{-1} in the equation of US_R, c_US_R the constant of that equation, and the covariance parameters are covar_sigma_<unit>_<var> and covar_<unit_i>_<var_i>_<unit_j>_<var_j>;

  • restrictions, identifying restrictions, shock names and every output (impulse responses, decompositions, forecasts, residuals) use them.

The variables are held in canonical (alphabetical) order; a Choleski identification nevertheless follows the order in which they were declared (see below).

5.3. Panel estimators

The estimator is the option estim_panel_estimator. It can be given to the constructor or to estimate:

mdl = prfvar_model(units, endog, 'lag_length', 4, ...
    'estim_panel_estimator', 'pooled');

mdl = estimate(mdl, 'data', db);

% or, equivalently
mdl = estimate(mdl, 'data', db, 'estim_panel_estimator', 'pooled');

Every estimator is a set of linear restrictions on the coefficients of the stacked VAR:

estim_panel_estimator

Restrictions

'unrestricted' (default)

None: every unit’s equations load on the lags of every unit.

'independent'

No unit reacts to the lags of another unit. Nothing else is shared: a separate VAR per unit, estimated jointly.

'pooled'

As 'independent', and all units share the same lag coefficients, constants and deterministic coefficients.

'fixed_effects'

As 'pooled', except that each unit keeps its own constant.

'dynamic_homogeneity'

As 'independent', and all units share the same lag coefficients (constants and deterministic coefficients are unit-specific).

'static_homogeneity'

As 'independent', and all units share the same constants and deterministic coefficients (lag coefficients are unit-specific).

'mean_group'

Estimated as 'independent', then every coefficient of a unit’s equations is replaced by its average across units.

The residual covariance is left free, cross-unit correlations included. The restrictions are imposed wherever the coefficients are estimated or drawn: the least-squares estimation, the posterior mode, bootstrap and sample_posterior. They add to estim_linear_restrictions, so a tailored panel is any estimator plus restrictions of your own on the stacked coefficients, e.g. an unrestricted panel in which the large units do not react to a small one:

restr = {'b1_US_R_MX_PAI = 0'; ...};

mdl = estimate(mdl, 'data', db, 'estim_linear_restrictions', restr);

On a model that is not a panel, any estimator other than 'unrestricted' is an error.

What the estimators mean, in closed form:

  • 'independent' gives each unit the coefficients and the residuals of its own VAR (the residual covariance differs only by the degrees-of-freedom correction, since the stacked VAR has more regressors per equation);

  • 'pooled' is least squares on the units’ observations stacked on top of each other;

  • 'fixed_effects' is least squares on the same pooled sample with one dummy per unit.

5.4. Estimation

Without priors and without regime switching, estimate computes the (restricted) least-squares estimate in closed form. With a conjugate VAR prior (estim_var_prior: minnesota, inw, niw, generate_niw_prior, Sims-Zha) and without regime switching, the posterior mode is computed without a search too, under the same restrictions (see “How the mode is found” in Reduced-form VAR Modeling). With other priors (estim_priors) or with regime switching, the posterior mode is found numerically, under the same restrictions; a VAR prior is defined on the stacked VAR (its variables are the <unit>_<var> names) and is evaluated at each regime’s reduced form. 'mean_group' is a classical estimator: with priors or regime switching it is an error.

The numerical search runs over the free coefficients and the residual covariance, whose size grows with the square of the number of stacked variables: a pooled panel of three units and four variables has 36 free coefficients and 78 covariance parameters. Keep switching panels small. The finite-difference Hessian at the mode costs on the order of the square of that count in posterior evaluations: skip it (estim_hessian_type = 'none') when the posterior is then sampled with sample_posterior. A closed-form mode needs no finite differences: its Hessian is exact.

bootstrap re-estimates every artificial sample under the estimator, so every draw of a pooled panel is pooled. sample_posterior draws the posterior of a panel estimated with a Gaussian coefficient prior within the same restrictions. Both return the model carrying one parameterization per draw.

5.5. Identification, IRFs, decompositions, forecasting

These are called exactly as for a reduced-form VAR: identify (or identification to inspect the rotation), irf, variance_decomposition, historical_decomposition, forecast, and conditional forecasts through a simulation plan (simplan). Identifying restrictions are written on the stacked names, across units as well: 'US_R{0}@US_mp', or 'CA_GROWTH{inf}@MX_mp' for a long-run restriction of one unit’s shock on another unit. A Choleski identification follows the declaration order of the stacked variables, unit by unit in the order the units were given and, within a unit, the variables in the order they were given (prfvar_model({'US','CA'}, {'GROWTH','PAI','R'}) orders US_GROWTH, US_PAI, US_R, CA_GROWTH, ...); its default shock names (<unit>_<var>_SHOCK) say which variable each shock is attached to, and 'ordering' sets another order. Earlier versions used the alphabetical order of the stacked names. See Reduced-form VAR Modeling for the call patterns and the plotting helpers (quick_irfs, plot_fanchart, plot_decomp).

5.6. Adding regime switching

Pass a Markov-chain structure through the markov_chains keyword and list the parameters it controls, on the stacked names. For instance, the policy-rate equation of every unit switching:

mc = struct('name', 'mpcoef', 'number_of_states', 2, ...
    'controlled_parameters', {{'b(US_R)','b(CA_R)','b(MX_R)','b(BR_R)'}}, ...
    'endogenous_probabilities', [], 'probability_parameters', []);

The panel estimator holds in every regime: in a pooled panel the switching coefficients are common to the units in state 1 and common to the units in state 2. A coefficient that switches in one unit and not in another is tied to it in every state, which leaves it effectively constant: let the same chain control the corresponding coefficients of every unit. Time-varying transition probabilities are specified exactly as in Reduced-form VAR Modeling, and the switching parameters are given priors through estim_priors.

5.7. Tutorials

  • rise-modern-tutorials/ModelShapes/panel_var/howto.m: the estimators on three countries, what each imposes, the independent panel against the country VARs, cross-unit identification and the bootstrap under pooling.

  • The unit-test repository walks through a full panel analysis in models/var/panel/panel (tut01 to tut15): country versus panel VARs, identification, impulse responses, decompositions, forecasts, Bayesian estimation and posterior sampling, conditional forecasts with entropic tilting, all the estimators, and a switching panel.