*! version 1.0.1 21aug2026

Title

gvar diag -- residual diagnostics, equation by equation and system-wide

Syntax

gvar diag [, options]

options

psc(#) order of the serial-correlation F test. Default 4.

arch(#) order of the univariate ARCH-LM test. Default 4.

multivariate add the system-wide tests.

lagspt(#) portmanteau order. Default 16.

lagsbg(#) Breusch-Godfrey order. Default 5.

mvarch(#) multivariate ARCH order. Default 2.

reps(#) bootstrap p-values from this many replications.

seed(#) random-number seed for the bootstrap.

detail residual descriptives, White heteroskedasticity, R-squared.

nosummary suppress the tables.

saving(name) savemv(name) save the univariate and multivariate matrices.

Description

gvar diag reports the Toolbox's per-equation battery - serial
correlation F, Jarque-Bera, ARCH-LM, skewness and kurtosis - and, with
multivariate, the system-wide tests that GVARX adds: multivariate
Jarque-Bera, the portmanteau statistics Qh and Qh*, multivariate ARCH-LM, the
Breusch-Godfrey LM and the Edgerton-Shukur F.

An equation can look clean one at a time and still fail as a system, because
the univariate tests ignore the contemporaneous correlation across the
equations of the same country model.

Options

psc(#) the order of the serial-correlation F test, default 4, and
arch(#) the order of the ARCH test, default 4.

multivariate adds the system-wide tests, with lagspt(#) the
Portmanteau lag length (default 16), lagsbg(#) the multivariate
Breusch-Godfrey order (default 5), and mvarch(#) the multivariate ARCH
order (default 2).

reps(#) and seed(string) bootstrap the critical values rather than
using asymptotic ones, which matters here: the asymptotic distributions of the
system-wide statistics are poor approximations at T = 134 with K = 136.

detail prints the per-equation table rather than the per-unit summary.

graph and name() plot each statistic against its cutoff;
saving() and savemv(name) write the univariate and multivariate
tables to datasets. nosummary suppresses the report.

On the Breusch-Godfrey test. GVARX's own version passes only the short-run
block of regressors, omitting the r_i error-correction terms, which inflates
the statistic in proportion to r_i / k_i. Corrected here: empirical size of
the Edgerton-Shukur F moved from 0.108 to 0.066 on average, and from 0.248 to
0.116 for Australia, whose rank is 5 of 6. See
gvar methods.

Remarks

Read the bootstrap p-values in preference to the asymptotic ones. A Monte
Carlo at this model's own dimensions puts the adjusted portmanteau Qh* at
three to nine times its nominal size, rising with the block size, and the
Edgerton-Shukur F at about twice nominal for a unit whose rank is close to its
block size. Only Qh at h = 16 and the multivariate Jarque-Bera hold up
unaided. reps() removes the approximation entirely.

On the lag orders. GVARX's default of 5 for the multivariate ARCH test is
meant for small VARs; a six-variable country model would need 106 auxiliary
regressors against about 110 usable quarters. The order is cut back until
there are at least three observations per regressor, and the orders actually
used are printed in the h,h,q column so a shortened lag is never passed
off as the one requested.

There are no dots in these tables. Every equation has residuals, so every
cell is computable. If you see a missing value here, something failed.

Examples

. gvar diag
. gvar diag, detail
. gvar diag, multivariate
. gvar diag, multivariate reps(200)

Stored results

gvar diag stores the following in r():

r(diag) the per-equation matrix

r(diagmv) the system-wide matrix

r(diagboot) bootstrap p-values

r(nequations) equations diagnosed

r(nsc) serial-correlation rejections

r(njb) non-normality rejections

r(narch) ARCH rejections

r(nwhite) heteroskedasticity rejections

r(reps) bootstrap replications that converged

Source

Toolbox Ftest_rsc.m, jarquebera.m, dstats.m; GVARX
.jb.multi, .pt.multi, .bgserial, .arch.multi.

Author

Dr Merwan Roudane

merwanroudane920@gmail.com

https://github.com/merwanroudane