VAR model -  Fit vector autoregressive models- use to resolve non-station time series which are a explain variable for each other.
ex: y = alpha1 + beta1 x +...
      x = alpha2 + beta2 y+...
VAR models is useful to explain many economic data, especially, in macro economics and financial data.
Before using a VAR model, we must determine lag problem of data. That called " Unit root test"
- There have more 2 method to find out lags of data which can use in VAR model.
+ The first, we use Dickey Fuller test:
dfuller serial-data1, lags(15)
dfuller  serial-data1, lags(15) noconstant
dfuller  serial-data1, lags(15) trend
as well as test for serial-data2
+ we can also use Phillips Perron test
pperron serial-data1, lags(15)
 
The second step is  use stata command to establish VAR model
 var serial1 serial2
Stata results will have some critia like BIC, AIC, SIC to help us determine the optimal lag-lenght.
To compare many var models (BIC, AIC, SIC)using differential lags, we  can use vary commands:
varsoc, lags(length)
var serial1 serial2, lags(lenght)


a stable VAR-model we want to eigenvalues to be less than one. This can be tested after the estimation using following command:
varstable
gives you a table with the eigenvalues for the estimated VAR. All lie inside the unit circle and that's good. If you use the option
varstable, graph
you get graph of the unit circle additional to the output table.
And, we estimated VAR model - basic. You can extend your model to follow many problems: tests after estimation, forecast or using many advanced VAR models. 
I will introduce that in later.
beak your legs.
--------------------------------stata help---------------------------------//------------------------------------------------//--------
 [TS] var -- Vector autoregressive models


Syntax

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

options                   Description
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Model
noconstant              suppress constant term
lags(numlist)           use lags numlist in the underlying VAR
exog(varlist)           use exogenous variables varlist

Model 2
constraints(numlist)    apply specified linear constraints
nolog                   suppress SURE iteration log
iterate(#)              set maximum number of iterations for SURE; default is iterate(1600)
tolerance(#)            set convergence tolerance of SURE
noisure                 use one-step SURE
dfk                     make small-sample degrees-of-freedom adjustment
small                   report small-sample t and F statistics
nobigf                  do not compute parameter vector for coefficients implicitly set to zero

Reporting
level(#)                set confidence level; default is level(95)
lutstats                report Lütkepohl lag-order selection statistics
nocnsreport             do not display constraints
display_options         control column formats, row spacing, and line width

coeflegend              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, 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:  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)


Saved results

var saves 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, 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 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

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

0 comments:

Post a Comment