*! version 2.0.0 18feb2026

Title

rbfmvar -- Residual-Based Fully Modified VAR (RBFM-VAR) estimation for
nonstationary VARs with unknown mixtures of I(0), I(1), and I(2) components

Syntax

rbfmvar
varlist
[if] [in]
[, options]

Model
lags(#) VAR order p; default is lags(2)

maxlags(#) maximum lags for IC selection; default is maxlags(8)

ic(string) information criterion: aic, bic, hq, or none; default is ic(none)

LRV Estimation
kernel(string) kernel function: bartlett, parzen, or qs; default is kernel(bartlett)

bandwidth(#) bandwidth for kernel; default is automatic (Andrews 1991)

Testing
granger(string) Granger non-causality test: granger("y1 -> y2")

Post-estimation
irf(#) impulse response horizon; default is irf(0) (skip)

bootreps(#) bootstrap replications for IRF CI; default is bootreps(500)

bootci(#) confidence level for IRF CI (50-99); default is bootci(90)

fevd compute forecast error variance decomposition

forecast(#) multi-step ahead forecast; default is forecast(0) (skip)

Reporting
noprint suppress output table

level(#) confidence level; default is level(95)

rbfmvar_graph [, irf eig density fevd forecast
combine saving(string) nodisplay]

rbfmvar_simulate [, case(string) nobs(#) reps(#) kernel(string) saving(string) seed(#) noprint]

Description

rbfmvar implements the Residual-Based Fully Modified VAR (RBFM-VAR) estimator
proposed by Chang (2000). The method provides valid estimation and inference for
nonstationary Vector Autoregressions (VARs) containing any unknown mixture of
I(0) (stationary), I(1) (unit root), and I(2) (double unit root) variables, which
may be cointegrated in any form.

The key advantages over standard OLS-VAR estimation are:

1. No prior knowledge required: The estimator does not require pretesting
for unit roots or specifying the cointegration rank.

2. Mixed-normal asymptotics: The RBFM-VAR estimator has a mixed normal
limiting distribution, avoiding the nuisance-parameter-dependent distributions
that plague OLS-VAR inference in nonstationary settings.

3. Valid Granger causality testing: The modified Wald test W_F+ is
asymptotically bounded by chi-square, enabling conservative but valid causality
tests regardless of integration orders.

4. Bootstrap IRF confidence intervals: Residual-based bootstrap provides
percentile confidence intervals for impulse response functions.

5. FEVD and Forecasting: Forecast error variance decomposition and
multi-step ahead forecasts with error bands.

rbfmvar_graph produces post-estimation graphs including impulse response
functions (with bootstrap CI bands), eigenvalue stability diagrams, residual
density plots, FEVD stacked area charts, and forecast fan charts.

rbfmvar_simulate reproduces the Monte Carlo simulation from Section 5 of
Chang (2000) for the three DGP cases (A, B, C).

Options

Model

lags(#) specifies the VAR order p. Default is 2.

maxlags(#) specifies the maximum lag order to consider when using
information criterion lag selection. Default is 8.

ic(string) selects the lag order using an information criterion.
Options are aic (Akaike), bic (Bayesian), hq (Hannan-Quinn),
or none (use lags() directly). Default is none.
When specified, the output includes a comparison table of all ICs across lag orders.

LRV Estimation

kernel(string) specifies the kernel function for long-run variance
estimation. Options are bartlett (Bartlett/Newey-West), parzen,
or qs (Quadratic Spectral). Default is bartlett.

bandwidth(#) specifies the bandwidth parameter K for kernel
estimation. If not specified (or set to -1), the bandwidth is selected
automatically using the Andrews (1991) data-driven rule.

Testing

granger(string) performs a Granger non-causality test using the
modified Wald statistic W_F+ from Theorem 2 of Chang (2000). The
argument is specified as granger("varname1 -> varname2") to test
H0: varname1 does NOT Granger-cause varname2.

Post-estimation

irf(#) computes impulse response functions up to the specified
horizon. Set to 0 (default) to skip IRF computation. Required for FEVD.

bootreps(#) specifies the number of bootstrap replications for IRF
confidence intervals. Default is 500. Set to 0 to skip bootstrap CI.

bootci(#) specifies the confidence level for bootstrap IRF bands
(between 50 and 99). Default is 90.

fevd requests computation of the Forecast Error Variance Decomposition
(FEVD) using Cholesky-orthogonalized IRFs.

forecast(#) computes multi-step ahead forecasts from the estimated
VAR companion form with forecast error standard errors.

Methodology

ECM Reparameterization. The levels VAR (Eq. 1 in Chang 2000):

y_t = A_1 y_ + ... + A_p y_ + epsilon_t

is reparameterized into (Eq. 3):

y_t = Gamma * z_t + A * w_t + epsilon_t

where z_t contains stationary second-difference lags and
w_t = (Delta y_', y_')' contains nonstationary regressors.

RBFM-VAR Estimator. The correction (Eqs. 12-13) removes endogeneity
via Y+ = Y' - Omega_ev * Omega_vv^{-1} * V' and serial correlation via
A+ = (0,I) * Delta_vdw, where v_hat_t is constructed from a restricted
first-order autoregression (Eq. 11).

Modified Wald Test. For linear restrictions H0: R vec(F) = r, the
modified Wald statistic W_F+ has a limit distribution bounded above by
chi-square with q degrees of freedom (Theorem 2). Standard critical values
yield conservative but valid tests.

Bootstrap IRF CI. Residual-based bootstrap: (i) center and resample
OLS residuals with replacement, (ii) reconstruct bootstrap data, (iii) re-estimate
RBFM-VAR, (iv) compute IRFs, (v) repeat B times, (vi) construct percentile CI bands.

FEVD. Using Cholesky-orthogonalized IRFs (Phi_h * P where P = chol(Sigma_e)),
the FEVD at horizon h for variable i due to shock j is the cumulative squared
orthogonalized response divided by total forecast error variance.

Examples

Example 1: Basic estimation

. clear

. set obs 200

. set seed 12345

. gen t = _n

. tsset t

. gen y1 = sum(rnormal())

. gen y2 = sum(rnormal())

. rbfmvar y1 y2, lags(1) kernel(bartlett)

Example 2: Granger causality test

. rbfmvar y1 y2, lags(1) granger("y2 -> y1")

Example 3: IRF with bootstrap confidence intervals

. rbfmvar y1 y2, lags(1) irf(20) bootreps(500) bootci(90)

. rbfmvar_graph, irf

Example 4: FEVD with visualization

. rbfmvar y1 y2, lags(1) irf(20) fevd

. rbfmvar_graph, fevd

Example 5: Forecasting with fan chart

. rbfmvar y1 y2, lags(1) forecast(10)

. rbfmvar_graph, forecast

Example 6: Automatic lag selection with IC table

. rbfmvar y1 y2, ic(aic) maxlags(6) irf(20)

Example 7: Complete analysis

. rbfmvar y1 y2, lags(1) irf(20) bootreps(200) bootci(95) fevd forecast(8)

. rbfmvar_graph, irf fevd forecast eig density

Example 8: Monte Carlo simulation

. rbfmvar_simulate, case(a) nobs(150) reps(1000)

Stored results

rbfmvar stores the following in e():

Scalars

e(N) number of observations

e(T_eff) effective sample size

e(n_vars) number of variables

e(p_lags) VAR order

e(bandwidth) kernel bandwidth used

e(wald_stat) modified Wald statistic (if Granger test)

e(wald_pval) conservative p-value (if Granger test)

e(wald_df) degrees of freedom (if Granger test)

e(irf_horizon) IRF horizon (if computed)

e(irf_ci_level) IRF CI level (if bootstrap)

e(irf_boot_reps) IRF bootstrap replications

e(forecast_steps) forecast steps ahead

Matrices

e(F_ols) full OLS-VAR coefficient matrix

e(F_plus) full RBFM-VAR corrected coefficient matrix

e(SE_mat) standard error matrix

e(Pi1_ols) OLS Pi_1 (coeff on Delta y_)

e(Pi2_ols) OLS Pi_2 (coeff on y_)

e(Pi1_plus) RBFM-VAR Pi_1+

e(Pi2_plus) RBFM-VAR Pi_2+

e(Sigma_e) error covariance matrix

e(Omega_ev) LRV of (epsilon,v)

e(Omega_vv) LRV of v

e(Delta_vdw) one-sided LRV

e(irf) IRF matrix (if computed)

e(irf_lo) lower IRF CI bound (if bootstrap)

e(irf_hi) upper IRF CI bound (if bootstrap)

e(fevd) FEVD matrix (if computed)

e(forecast) forecast values (if computed)

e(forecast_se) forecast standard errors (if computed)

e(residuals) estimation residuals

Macros

e(cmd) rbfmvar

e(cmdline) command as typed

e(varlist) variable list

e(kernel) kernel function used

e(ic) information criterion

e(granger) Granger test specification

References

Chang, Y. (2000). Vector Autoregressions with Unknown Mixtures of I(0), I(1),
and I(2) Components. Econometric Theory, 16(6), 905-926.

Chang, Y. and P.C.B. Phillips (1995). Time series regression with mixtures of
integrated processes. Econometric Theory, 11, 1033-1094.

Phillips, P.C.B. (1995). Fully modified least squares and vector autoregression.
Econometrica, 63, 1023-1078.

Phillips, P.C.B. (1991). Optimal inference in cointegrated systems.
Econometrica, 59, 283-306.

Andrews, D.W.K. (1991). Heteroskedasticity and autocorrelation consistent
covariance matrix estimation. Econometrica, 59(3), 817-858.

Toda, H. and P.C.B. Phillips (1993). Vector autoregressions and causality.
Econometrica, 61, 1367-1393.

Author

Dr. Merwan Roudane

Independent Researcher

Email: merwanroudane920@gmail.com

Please cite Chang (2000) and this package when using RBFM-VAR in your research.