**[TS] var** -- Vector autoregressive models

__Syntax__

**var** *depvarlist* [*if*] [*in*] [**,** *options*]

*options* Description
-------------------------------------------------------------------------
Model
__nocons__**tant** suppress constant term
__la__**gs(***numlist***)** use lags *numlist* in the VAR
__ex__**og(***varlist***)** use exogenous variables *varlist*

Model 2
__const__**raints(***numlist***)** apply specified linear constraints
__nolo__**g** suppress SURE iteration log
__it__**erate(***#***)** set maximum number of iterations for SURE;
default is **iterate(1600)**
__tol__**erance(***#***)** set convergence tolerance of SURE
__nois__**ure** use one-step SURE
**dfk** make small-sample degrees-of-freedom adjustment
__sm__**all** report small-sample t and F statistics
__nobig__**f** do not compute parameter vector for
coefficients implicitly set to zero

Reporting
__l__**evel(***#***)** set confidence level; default is **level(95)**
__lut__**stats** report Lütkepohl lag-order selection statistics
__nocnsr__**eport** do not display constraints
*display_options* control columns and column formats, row
spacing, and line width

__coefl__**egend** display legend instead of statistics
-------------------------------------------------------------------------
You must **tsset** your data before using **var**; see **[TS] tsset**.
*depvarlist* and *varlist* may contain time-series operators; see tsvarlist.
**by**, **fp**, **rolling**, **statsby**, and **xi** are allowed; see prefix.
**coeflegend** does not appear in the dialog box.
See **[TS] var postestimation** for features available after estimation.

__Menu__

**Statistics > Multivariate time series > Vector autoregression (VAR)**

__Description__

**var** fits a multivariate time-series regression of each dependent variable
on lags of itself and on lags of all the other dependent variables. **var**
also fits a variant of vector autoregressive (VAR) models known as the
VARX model, which also includes exogenous variables. See **[TS] var intro**
for a list of commands that are used in conjunction with **var**.

__Options__

+-------+
----+ Model +------------------------------------------------------------

**noconstant**; see **[R] estimation options**.

**lags(***numlist***)** specifies the lags to be included in the model. The
default is **lags(1 2)**. This option takes a *numlist* and not simply an
integer for the maximum lag. For example, **lags(2)** would include only
the second lag in the model, whereas **lags(1/2)** would include both the
first and second lags in the model. See *numlist* and tsvarlist for
more discussion of numlists and lags.

**exog(***varlist***)** specifies a list of exogenous variables to be included in
the VAR.

+---------+
----+ Model 2 +----------------------------------------------------------

**constraints(***numlist***)**; see **[R] estimation options**.

**nolog** suppresses the log from the iterated seemingly unrelated regression
algorithm. By default, the iteration log is displayed when the
coefficients are estimated through iterated seemingly unrelated
regression. When the **constraints()** option is not specified, the
estimates are obtained via OLS, and **nolog** has no effect. For this
reason, **nolog** can be specified only when **constraints()** is specified.
Similarly, **nolog** cannot be combined with **noisure**.

**iterate(***#***)** specifies an integer that sets the maximum number of
iterations when the estimates are obtained through iterated seemingly
unrelated regression. By default, the limit is 1,600. When
**constraints()** is not specified, the estimates are obtained using OLS,
and **iterate()** has no effect. For this reason, **iterate()** can be
specified only when **constraints()** is specified. Similarly, **iterate()**
cannot be combined with **noisure**.

**tolerance(***#***)** specifies a number greater than zero and less than 1 for the
convergence tolerance of the iterated seemingly unrelated regression
algorithm. By default, the tolerance is **1e-6**. When the
**constraints()** option is not specified, the estimates are obtained
using OLS, and **tolerance()** has no effect. For this reason,
**tolerance()** can be specified only when **constraints()** is specified.
Similarly, **tolerance()** cannot be combined with **noisure**.

**noisure** specifies that the estimates in the presence of constraints be
obtained through one-step seemingly unrelated regression. By
default, **var** obtains estimates in the presence of constraints through
iterated seemingly unrelated regression. When **constraints()** is not
specified, the estimates are obtained using OLS, and **noisure** has no
effect. For this reason, **noisure** can be specified only when
**constraints()** is specified.

**dfk** specifies that a small-sample degrees-of-freedom adjustment be used
when estimating the error variance-covariance matrix. Specifically,
1/(T-mparms) is used instead of the large-sample divisor 1/T, where
mparms is the average number of parameters in the functional form for
y_t over the K equations.

**small** causes **var** to report small-sample *t* and *F* statistics instead of the
large-sample normal and chi-squared statistics.

**nobigf** requests that **var** not save the estimated parameter vector that
incorporates coefficients that have been implicitly constrained to be
zero, such as when some lags have been omitted from a model. **e(bf)**
is used for computing asymptotic standard errors in the
postestimation commands **irf create** and **fcast compute**. Therefore,
specifying **nobigf** implies that the asymptotic standard errors will
not be available from **irf create** and **fcast compute**. See *Fitting*
*models with some lags excluded* in **[TS] var**.

+-----------+
----+ Reporting +--------------------------------------------------------

**level(***#***)**; see **[R] estimation options**.

**lutstats** specifies that the Lütkepohl versions of the lag-order selection
statistics be reported. See *Methods and formulas* in **[TS] varsoc** for
a discussion of these statistics.

**nocnsreport**; see **[R] estimation options**.

*display_options*: **noci**, __nopv__**alues**, **vsquish**, **cformat(***%fmt***)**, **pformat(%***fmt***)**,
**sformat(%***fmt***)**, and **nolstretch**; see **[R] estimation options**.

The following option is available with **var** but is not shown in the dialog
box:

**coeflegend**; see **[R] estimation options**.

__Examples__

Setup
**. webuse lutkepohl2**
**. tsset**

Fit vector autoregressive model with 2 lags (the default)
**. var dln_inv dln_inc dln_consump**

Fit vector autoregressive model restricted to specified period
**. var dln_inv dln_inc dln_consump if qtr<=tq(1978q4)**

Same as above, but include first, second, and third lags in model
**. var dln_inv dln_inc dln_consump if qtr<=tq(1978q4), lags(1/3)**

Same as above, but report the Lütkepohl versions of the lag-order
selection statistics
**. var dln_inv dln_inc dln_consump if qtr<=tq(1978q4), lags(1/3)**
**lutstats**

Replay results with 99% confidence interval
**. var, level(99)**

__Stored results__

**var** stores the following in **e()**:

Scalars
**e(N)** number of observations
**e(N_gaps)** number of gaps in sample
**e(k)** number of parameters
**e(k_eq)** number of equations in **e(b)**
**e(k_dv)** number of dependent variables
**e(df_eq)** average number of parameters in an equation
**e(df_m)** model degrees of freedom
**e(df_r)** residual degrees of freedom (**small** only)
**e(ll)** log likelihood
**e(ll_dfk)** **dfk** adjusted log likelihood (**dfk** only)
**e(obs_***#***)** number of observations on equation *#*
**e(k_***#***)** number of parameters in equation *#*
**e(df_m***#***)** model degrees of freedom for equation *#*
**e(df_r***#***)** residual degrees of freedom for equation *#* (**small**
only)
**e(r2_***#***)** R-squared for equation *#*
**e(ll_***#***)** log likelihood for equation *#*
**e(chi2_***#***)** chi-squared for equation *#*
**e(F_***#***)** F statistic for equation *#* (**small** only)
**e(rmse_***#***)** root mean squared error for equation *#*
**e(aic)** Akaike information criterion
**e(hqic)** Hannan-Quinn information criterion
**e(sbic)** Schwarz-Bayesian information criterion
**e(fpe)** final prediction error
**e(mlag)** highest lag in VAR
**e(tmin)** first time period in sample
**e(tmax)** maximum time
**e(detsig)** determinant of **e(Sigma)**
**e(detsig_ml)** determinant of Sigma_ml hat
**e(rank)** rank of **e(V)**

Macros
**e(cmd)** **var**
**e(cmdline)** command as typed
**e(depvar)** names of dependent variables
**e(endog)** names of endogenous variables, if specified
**e(exog)** names of exogenous variables, and their lags, if
specified
**e(exogvars)** names of exogenous variables, if specified
**e(eqnames)** names of equations
**e(lags)** lags in model
**e(exlags)** lags of exogenous variables in model, if specified
**e(title)** title in estimation output
**e(nocons)** **nocons**, if **noconstant** is specified
**e(constraints)** **constraints**, if **constraints()** is specified
**e(cnslist_var)** list of specified constraints
**e(small)** **small**, if specified
**e(lutstats)** **lutstats**, if specified
**e(timevar)** time variable specified in **tsset**
**e(tsfmt)** format for the current time variable
**e(dfk)** **dfk**, if specified
**e(properties)** **b V**
**e(predict)** program used to implement **predict**
**e(marginsok)** predictions allowed by **margins**
**e(marginsnotok)** predictions disallowed by **margins**
**e(marginsdefault)** default **predict()** specification for **margins**

Matrices
**e(b)** coefficient vector
**e(Cns)** constraints matrix
**e(Sigma)** Sigma hat matrix
**e(V)** variance-covariance matrix of the estimators
**e(bf)** constrained coefficient vector
**e(exlagsm)** matrix mapping lags to exogenous variables
**e(G)** Gamma matrix; see *Methods and formulas* in **[TS] var**

Functions
**e(sample)** marks estimation sample