Vector autoregression
vecar depvarlist [if exp] [in range] ,maxlag(#) [ noconstant exog(varlist) cov dfk noheader table level(#) saving(name)} using(name) uncorr ]
vecar is for use with time-series data. You must tsset your data before using vecar; see help tsset.
by ... : may be used with vecar; see help by.
vecar shares the features of all estimation commands; see help est.
The syntax of predict after vecar is
predict [type] newvarname [if exp] [in range] [, equation(eqno[,eqno]) { xb | stdp | residuals | difference | stddp }]
These statistics are available both in and out of sample; type "predict ... if e(sample) ..." if wanted only for the estimation sample.
Description
vecar estimates vector autoregression (VAR) models. Each of the variables in depvarlist is regressed on maxlag lags of depvarlist, a constant (unless suppressed) and the exogenous variables provided in varlist (if any). varlist may contain time-series operators.
A set of "block F" tests evaluates the joint significance of each variable's lagged values in each equation.
Options
maxlag must be specified, and must be at least 1.
noconstant omits the constant term from estimation.
exog(varlist) specifies the exogenous variables to be included in each equation.
cov displays the covariance matrix of the residuals between equations. The divisor of the covariance terms is T, the number of sample observations, unless the dfk option is invoked. A comparison of this model with the zero-lag model (as a likelihood ratio test) is computed. Three criteria often employed for lag length selection are produced: the AIC (Akaike Information Criterion), BIC (Bayes or Schwarz Information Criterion) and the HQ (Hannan-Quinn) criterion. The cov option also causes three tests on the residuals to be performed: the multivariate portmanteau test of Ljung and Box, implemented in wntstmvq (STB-60), the test for independence of the errors of Breusch and Pagan, implemented in mvreg, and the Doornik-Hansen omnibus test for multivariate normality, implemented in omninorm. These tests make use of Stata's matrix language; it may be necessary to use set matsize to increase the default matrix size before reading in the data.
dfk specifies the use of an alternate divisor in computing the covariance matrix for the equation errors. As an asymptotically justified estimator, vecar by default uses the number of sample observations (T) as a divisor. When the dfk option is set, a small-sample adjustment is made and the divisor is taken to be sqrt(T - k).
noheader suppresses display of the table reporting F statistics, R-squared, and root mean square error above the coefficient table.
table displays the full coefficient table.
level(#) specifies the confidence level, in percent, for confidence intervals; see help level.
saving(name) specifies that the log determinant of the residual covariance matrix associated with this model is to be saved as name.
using(name) specifies the name of the model against which this model is to be tested. The saved model should have a greater lag length, so that the likelihood ratio test compares the more general saved model with the restricted model currently estimated.
uncorr specifies that the likelihood ratio tests for lag length implemented by saving and using, as well as the test against the zero-order model implemented by cov, are to be conducted without the adjustment for degrees of freedom advocated by Sims (1980). Without this option, the difference between log determinants of the respective covariance matrices is scaled by (T-c), where T is the number of observations and c is the number of regressors in each of the unrestricted model's equations. With the uncorr option, the multiplier is merely T.
Options for predict
equation(eqno[,eqno]) specifies to which equation you are referring.
equation() is filled in with one eqno for options xb, stdp, and residuals. equation(#1) would mean the calculation is to be made for the first equation, equation(#2) would mean the second, and so on. Alternatively, you could refer to the equations by their names. equation(income) would refer to the equation named income and equation(hours) to the equation named hours.
If you do not specify equation(), results are as if you specified equation(#1).
stddp and difference refer to between-equation concepts. To use these options, you must specify equation(#1,#2) or equation(income,hours). When two equations must be specified, equation() is not optional.
xb, the default, calculates the linear prediction from the estimated model.
stdp calculates the standard error of the linear prediction.
residuals calculates the residuals.
difference calculates the difference between the linear predictions of two equations in the system.
stddp calculates the standard error of the difference in linear predictions between two equations.
Examples
. use http://fmwww.bc.edu/ec-p/data/macro/wgmacro.dta,clear
. vecar dlinvestment dlincome dlconsumption , maxlag(2)
. vecar dlinvestment dlincome dlconsumption , maxlag(2) table exog(qtr) cov
. predict ihat,eq(dlinvestment)
. predict ieps,resid eq(dlinvestment)
. mat list e(Sigma)
. dis "Log-likelihood with `e(maxlag)' lags: `e(ll)'"
. vecar dlinvestment dlincome dlconsumption if tin(1965q1,), maxlag(3) exog(qtr)
To reproduce Lutkepohl, 1993, Table 4.4:
. vecar dlinvestment dlincome dlconsumption if tin(1961q2,1978q4), maxlag(4) saving(4) uncorr
. vecar dlinvestment dlincome dlconsumption if tin(1961q2,1978q4), maxlag(3) using(4) saving(3) uncorr
. vecar dlinvestment dlincome dlconsumption if tin(1961q2,1978q4), maxlag(2) using(3) saving(2) uncorr
. vecar dlinvestment dlincome dlconsumption if tin(1961q2,1978q4), maxlag(1) using(2) uncorr
To estimate a VAR for each unit of a panel :
. use http://fmwww.bc.edu/ec-p/data/Greene2000/TBL15-1,clear
. tsset firm year,yearly
. by firm: vecar i f c, maxlag(2) exog(year)
References
Lutkepohl, Helmut, 1993. Introduction to Multiple Time Series Analysis, 2d ed. Berlin: Springer-Verlag.
Sims, Christopher, 1980. Macroeconomics and Reality. Econometrica 48, 1-49.
Acknowledgements
Thanks to Vince Wiggins for assistance modifying this code to interact properly with predict, and to Richard Sperling for developing the AIC, BIC, HQ criteria code. Remaining errors are my own.
Author
Christopher F Baum, Boston College, USA, baum@bc.edu
Also see
On-line: help for est, reg3, mvreg, wntstmvq (if installed), omninorm (if installed), regress, predict