*! version 1.0.1 21aug2026

Title

gvar -- Global Vector Autoregressive modelling: estimation,
inference and dynamic analysis

Syntax

gvar subcommand [if] [in] [, options]

Every analysis follows the same order. Each step needs the one before it, and
gvar says so plainly if you skip one.

data and setup

gvar setup declare the panel, the units, the
domestic and global variables

gvar weights build or load the link weights

gvar foreign construct the foreign-specific
variables x*

gvar describe what is in memory, and the order
of the global vector

pre-estimation testing

gvar unitroot ADF, weighted-symmetric, ADF-GLS,
KPSS, Phillips-Perron

gvar lags select p and q for each country
model

gvar coint Johansen trace and maximal-eigenvalue
tests with Pesaran-Shin-Smith critical values

estimation

gvar estimate reduced-rank ML of every VECMX*
country model

gvar bayes Bayesian alternative to
gvar estimate: Minnesota, spike-and-slab or Normal-Gamma

gvar dominant dominant-unit / global exogenous
model, estimated before the country models are solved

gvar solve stack the country models and solve the
GVAR

specification testing

gvar wetest weak exogeneity of the foreign
variables

gvar contemp contemporaneous effects of foreign
on domestic variables

gvar avgcorr average pairwise cross-section
correlations

gvar diag residual diagnostics, univariate and
system-wide

gvar stability structural stability battery,
with bootstrap critical values

gvar overid LR test of over-identifying
restrictions on beta

gvar gc Granger and instantaneous causality

gvar bconv Geweke convergence diagnostic for the
chains from gvar bayes

gvar bforecast predictive density over the
retained draws, so the interval carries parameter uncertainty

gvar bdic deviance information criterion, for
comparing priors on the same data

dynamic analysis

gvar irf generalized, orthogonalised and structural
impulse responses

gvar fevd forecast error variance
decomposition

gvar pp persistence profiles of the cointegrating
relations

gvar spillover Diebold-Yilmaz
connectedness

gvar hd historical decomposition

gvar forecast point and conditional
forecasts

gvar tcdecomp Beveridge-Nelson trend/cycle
decomposition

reporting and model state

gvar report one specification audit of the fitted
model

gvar import read a GVAR Toolbox 2.0 workbook, one
sheet per variable

gvar save write the fitted model to disk

gvar use read it back

gvar clear drop the model from memory

Subcommands may be abbreviated. gvar est is gvar estimate,
gvar diag is gvar diagnostics. The four state commands
(save, use, clear, and gc) must be spelled out, so
that they cannot be reached by a slip of the keyboard.

Description

gvar fits and analyses the Global Vector Autoregressive model of
Pesaran, Schuermann and Weiner (2004) and Dees, di Mauro, Pesaran and Smith
(2007). It is a faithful Stata port of three reference implementations:

GVAR Toolbox 2.0 (L. Vanessa Smith and Alessandro Galesi, August 2014),
MATLAB

GVARX 1.2 (Ho Tsung-wu), R

BGVAR 2.6.0 (Boeck, Feldkircher and Huber), R

Every routine names the file and, where it matters, the line of the source it
follows. gvar methods carries the equations, the
step-to-source map, and a record of the places where the sources disagree
with each other or contain defects, with the evidence that settled each one.

The workflow

A GVAR is built in stages, and each stage has to succeed before the next is
meaningful:

1. setup tells gvar which variable belongs to which unit, which
variables are global, and how each country model is specified.

2. weights supply the link matrices W_i. Trade flows are the usual
choice; financial flows and equal weights are also supported.

3. foreign builds x*_it = W_i x_t, the weighted average of the other
units' variables that each country model treats as weakly exogenous.

4. estimate fits each VECMX* by reduced-rank ML, conditional on the
foreign variables being weakly exogenous.

5. solve stacks the country models into
G0 x_t = sum H_l x(t-l) + zeta_t
and inverts G0 to get the reduced form.

Only after solve do the dynamic subcommands become available. Before
it, the testing subcommands work on the country models individually.

A first session

The shipped demo reproduces the GVAR Toolbox's own 26-unit example: 33
countries with the euro area aggregated from its eight members, quarterly
from 1979Q2 to 2013Q1, six domestic variables and three commodity prices.
See gvar datasets.

. use gvar_demo26

. gvar setup y Dp eq ep r lr, unit(country) time(quarter) ///
global(poil pmat pmetal) gendog(poil=usa pmat=usa pmetal=usa) ///
spec(gvar_demospec.dta)

. gvar weights using gvar_flows.dta, flow(trade) source(partner) ///
destination(home) year(year) years(2009 2011) type(1) ///
map(gvar_demoagg.dta)

. gvar foreign
. gvar estimate, vce(nwest)
. gvar solve

Then, for instance, the response of output everywhere to a US interest-rate
shock, with bootstrap bands:

. gvar irf, shock(usa:r) response(y) step(24) reps(200) shuffle

or the connectedness of the system:

. gvar spillover, step(24) by(unit)

The whole thing, annotated. net get gvar is the
complete worked analysis: every stage on the shipped data, with the reasoning
for each choice alongside it. Select the code and run it, or copy it into a
do-file.

It shipped as gvar_example.do through version 1.0.0. SSC caps a package
description at 100 lines, so the example became a help page -- the same one
line in the package, but reachable by name and copyable from the viewer.

Once the model is fitted, gvar report gives you the
specification audit in one command, and gvar save stores the
solved model so later sessions do not have to re-estimate it.

What the model is

Each unit i has k_i domestic variables y_it and k*_i
weakly exogenous foreign variables y*_it, built as a weighted average of
the other units' variables using weights w_ij that sum to one:

y*_it = sum_j w_ij y_jt

The country model is a VECMX*, a vector error-correction model with the
foreign variables entering as I(1) weakly exogenous regressors:

D y_it = c_i + alpha_i beta_i' z_i(t-1) + Lambda_i0 D y*_it
+ sum Gamma_il D z_i,t-l + eps_it

where z_it = (y_it', y*_it')'. Stacking all units through the link
matrices W_i gives the global model

G0 x_t = h0 + h1 t + sum_l H_l x(t-l) + zeta_t

which is solved for the reduced form
x_t = d0 + d1 t + sum_l F_l x(t-l) + eta_t
with F_l = G0^-1 H_l and eta_t = G0^-1 zeta_t. The
distinction between zeta and eta matters throughout and is a
frequent source of error; see gvar methods.

Sources

Pesaran, M. H., T. Schuermann and S. M. Weiner. 2004. Modeling regional
interdependencies using a global error-correcting macroeconometric model.
Journal of Business and Economic Statistics 22: 129-162.

Dees, S., F. di Mauro, M. H. Pesaran and L. V. Smith. 2007. Exploring the
international linkages of the euro area: a global VAR analysis.
Journal of Applied Econometrics 22: 1-38.

Pesaran, M. H. and Y. Shin. 1996. Cointegration and speed of convergence to
equilibrium. Journal of Econometrics 71: 117-143.

Pesaran, M. H. and Y. Shin. 1998. Generalized impulse response analysis in
linear multivariate models. Economics Letters 58: 17-29.

Smith, L. V. and A. Galesi. 2014. GVAR Toolbox 2.0 User Guide.
University of Cambridge.

Diebold, F. X. and K. Yilmaz. 2014. On the network topology of variance
decompositions. Journal of Econometrics 182: 119-134.

Author

Dr Merwan Roudane

merwanroudane920@gmail.com

https://github.com/merwanroudane