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
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
estimatecarries 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_PAIis the coefficient ofCA_PAI{-1}in the equation ofUS_R,c_US_Rthe constant of that equation, and the covariance parameters arecovar_sigma_<unit>_<var>andcovar_<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:
|
Restrictions |
|---|---|
|
None: every unit’s equations load on the lags of every unit. |
|
No unit reacts to the lags of another unit. Nothing else is shared: a separate VAR per unit, estimated jointly. |
|
As |
|
As |
|
As |
|
As |
|
Estimated as |
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(tut01totut15): 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.