tsvec
tsvec
com
vec — Vector error-correction models
Description
vec fits a type of vector autoregression in which some of the variables are cointegrated by using
Johansen’s (1995) maximum likelihood method. Constraints may be placed on the parameters in the
cointegrating equations or on the adjustment terms. See [TS] vec intro for a list of commands that
are used in conjunction with vec.
Quick start
Vector error-correction model for y1, y2, and y3 using tsset data
vec y1 y2 y3
Use 4 lags for the underlying vector autoregressive (VAR) model
vec y1 y2 y3, lags(4)
Use 2 cointegrating equations
vec y1 y2 y3, lags(4) rank(2)
Add a linear trend in the cointegrating equations and a quadratic trend in the undifferenced data
vec y1 y2 y3, lags(4) rank(2) trend(trend)
Same as above, but without a trend or a constant
vec y1 y2 y3, lags(4) rank(2) trend(none)
Menu
Statistics > Multivariate time series > Vector error-correction model (VECM)
1
2 vec — Vector error-correction models
Syntax
vec depvarlist if in , options
options Description
Model
rank(#) use # cointegrating equations; default is rank(1)
lags(#) use # for the maximum lag in underlying VAR model
trend(constant) include an unrestricted constant in model; the default
trend(rconstant) include a restricted constant in model
trend(trend) include a linear trend in the cointegrating equations and a
quadratic trend in the undifferenced data
trend(rtrend) include a restricted trend in model
trend(none) do not include a trend or a constant
bconstraints(constraintsbc ) place constraintsbc on cointegrating vectors
aconstraints(constraintsac ) place constraintsac on adjustment parameters
Adv. model
sindicators(varlistsi ) include normalized seasonal indicator variables varlistsi
noreduce do not perform checks and corrections for collinearity among
lags of dependent variables
Reporting
level(#) set confidence level; default is level(95)
nobtable do not report parameters in the cointegrating equations
noidtest do not report the likelihood-ratio test of overidentifying
restrictions
alpha report adjustment parameters in separate table
pi report parameters in Π = αβ0
noptable do not report elements of Π matrix
mai report parameters in the moving-average impact matrix
noetable do not report adjustment and short-run parameters
dforce force reporting of short-run, beta, and alpha parameters when
the parameters in beta are not identified; advanced option
nocnsreport do not display constraints
display options control columns and column formats, row spacing, and line width
Maximization
maximize options control the maximization process; seldom used
coeflegend display legend instead of statistics
Options
Model
Adv. model
sindicators(varlistsi ) specifies the normalized seasonal indicator variables to include in the model.
The indicator variables specified in this option must be normalized as discussed in Johansen (1995).
If the indicators are not properly normalized, the estimator of the cointegrating vector does not
converge to the asymptotic distribution derived by Johansen (1995). More details about how these
variables are handled are provided in Methods and formulas. sindicators() cannot be specified
with trend(none) or with trend(rconstant).
noreduce causes vec to skip the checks and corrections for collinearity among the lags of the
dependent variables. By default, vec checks to see whether the current lag specification causes
some of the regressions performed by vec to contain perfectly collinear variables; if so, it reduces
the maximum lag until the perfect collinearity is removed.
Reporting
mai displays a separate estimation table for the parameters in the moving-average impact matrix,
which is not displayed by default.
noetable suppresses the main estimation table that contains information about the estimated adjustment
parameters and the short-run parameters, which is displayed by default.
dforce displays the estimation tables for the short-run parameters and α and β—if the last two are
requested—when the parameters in β are not identified. By default, when the specified constraints
do not identify the parameters in the cointegrating equations, estimation tables are displayed only
for Π and the MAI.
nocnsreport; see [R] Estimation options.
display options: noci, nopvalues, vsquish, cformat(% fmt), pformat(% fmt), sformat(% fmt),
and nolstretch; see [R] Estimation options.
Maximization
maximize options: iterate(#), no log, trace, toltrace, tolerance(#), ltolerance(#),
afrom(matrixa ), and bfrom(matrixb ); see [R] Maximize.
toltrace displays the relative differences for the log likelihood and the coefficient vector at every
iteration. This option cannot be specified if no constraints are defined or if nolog is specified.
afrom(matrixa ) specifies a 1 ×(K ∗r) row vector with starting values for the adjustment parameters,
where K is the number of endogenous variables and r is the number of cointegrating equations
specified in the rank() option. The starting values should be ordered as they are reported in
e(alpha). This option cannot be specified if no constraints are defined.
bfrom(matrixb ) specifies a 1 × (m1 ∗ r) row vector with starting values for the parameters of the
cointegrating equations, where m1 is the number of variables in the trend-augmented system and
r is the number of cointegrating equations specified in the rank() option. (See Methods and
formulas for more details about m1 .) The starting values should be ordered as they are reported
in e(betavec). As discussed in Methods and formulas, for some trend specifications, e(beta)
contains parameter estimates that are not obtained directly from the optimization algorithm.
bfrom() should specify only starting values for the parameters reported in e(betavec). This
option cannot be specified if no constraints are defined.
The following option is available with vec but is not shown in the dialog box:
coeflegend; see [R] Estimation options.
Introduction
VEC models are used to model the stationary relationships between multiple time series that contain
unit roots. vec implements Johansen’s approach for estimating the parameters of a VEC model.
[TS] vec intro reviews the basics of integration and cointegration and highlights why we need
special methods for modeling the relationships between processes that contain unit roots. This manual
entry assumes familiarity with the material in [TS] vec intro and provides examples illustrating how to
use the vec command. See Johansen (1995), Hamilton (1994), and Becketti (2020) for more in-depth
introductions to cointegration analysis.
Example 1
This example uses annual data on the average per-capita disposable personal income in the eight
U.S. Bureau of Economic Analysis (BEA) regions of the United States. We use data from 1948–2002
in logarithms. Unit-root tests on these series fail to reject the null hypothesis that per-capita disposable
income in each region contains a unit root. Because capital and labor can move easily between the
different regions of the United States, we would expect that no one series will diverge from all the
remaining series and that cointegrating relationships exist.
Below we graph the natural logs of average disposal income in the New England and the Southeast
regions.
. use https://www.stata-press.com/data/r18/rdinc
. line ln_ne ln_se year
11
10
9 ln(New England)
ln(Southeast)
The graph indicates a differential between the two series that shrinks between 1960 and about
1980 and then grows until it stabilizes around 1990. We next estimate the parameters of a bivariate
VEC model with one cointegrating relationship.
6 vec — Vector error-correction models
D_ln_ne
_ce1
L1. -.4337524 .0721365 -6.01 0.000 -.5751373 -.2923675
ln_ne
LD. .7168658 .1889085 3.79 0.000 .3466119 1.08712
ln_se
LD. -.6748754 .2117975 -3.19 0.001 -1.089991 -.2597599
D_ln_se
_ce1
L1. -.3543935 .0754725 -4.70 0.000 -.5023168 -.2064701
ln_ne
LD. .3366786 .1976448 1.70 0.088 -.050698 .7240553
ln_se
LD. -.1605811 .2215922 -0.72 0.469 -.5948939 .2737317
Cointegrating equations
Equation Parms chi2 P>chi2
_ce1
ln_ne 1 . . . . .
ln_se -.9433708 .0054643 -172.64 0.000 -.9540807 -.9326609
_cons -.8964065 . . . . .
The default output has three parts. The header provides information about the sample, the model
fit, and the identification of the parameters in the cointegrating equation. The main estimation table
contains the estimates of the short-run parameters, along with their standard errors and confidence
intervals. The second estimation table reports the estimates of the parameters in the cointegrating
equation, along with their standard errors and confidence intervals.
vec — Vector error-correction models 7
The results indicate strong support for a cointegrating equation such that
ln ne − 0.943 ln se − 0.896
should be a stationary series. Identification of the parameters in the cointegrating equation is achieved
by constraining some of them to be fixed, and fixed parameters do not have standard errors. In this
example, the coefficient on ln ne has been normalized to 1, so its standard error is missing. As
discussed in Methods and formulas, the constant term in the cointegrating equation is not directly
estimated in this trend specification but rather is backed out from other estimates. Not all the elements
of the VCE that correspond to this parameter are readily available, so the standard error for the cons
parameter is missing.
To get a better idea of how our model fits, we predict the cointegrating equation and graph it over
time:
. predict ce, ce
. tsline ce
-.05
Predicted cointegrated equation
-.1
-.15
-.2
-.25
1950 1960 1970 1980 1990 2000
Year
Although the predicted cointegrating equation has the right appearance for the time before the
mid-1960s, afterward the predicted cointegrating equation does not look like a stationary series. A
better model would account for the trends in the size of the differential.
As discussed in [TS] vec intro, simply normalizing one of the coefficients to be one is sufficient to
identify the parameters of the single cointegrating vector. When there is more than one cointegrating
equation, more restrictions are required.
8 vec — Vector error-correction models
Example 2
We have data on monthly unemployment rates in Indiana, Illinois, Kentucky, and Missouri from
January 1978 through December 2003. We suspect that factor mobility will keep the unemployment
rates in equilibrium. The following graph plots the data.
. use https://www.stata-press.com/data/r18/urates, clear
. line missouri indiana kentucky illinois t
12
10
Missouri
8 Indiana
Kentucky
Illinois
6
2
1980m1 1985m1 1990m1 1995m1 2000m1 2005m1
Time
The graph shows that although the series do appear to move together, the relationship is not as clear
as in the previous example. There are periods when Indiana has the highest rate and others when
Indiana has the lowest rate. Although the Kentucky rate moves closely with the other series for most
of the sample, there is a period in the mid-1980s when the unemployment rate in Kentucky does not
fall at the same rate as the other series.
We will model the series with two cointegrating equations and no linear or quadratic time trends
in the original series. Because we are focusing on the cointegrating vectors, we use the noetable
option to suppress displaying the short-run estimation table.
vec — Vector error-correction models 9
_ce1
missouri 1 . . . . .
indiana 0 (omitted)
kentucky .3493902 .2005537 1.74 0.081 -.0436879 .7424683
illinois -1.135152 .2069063 -5.49 0.000 -1.540681 -.7296235
_cons -.3880707 .4974323 -0.78 0.435 -1.36302 .5868787
_ce2
missouri -1.11e-16 . . . . .
indiana 1 . . . . .
kentucky .2059473 .2718678 0.76 0.449 -.3269038 .7387985
illinois -1.51962 .2804792 -5.42 0.000 -2.069349 -.9698907
_cons 2.92857 .6743122 4.34 0.000 1.606942 4.250197
Except for the coefficients on kentucky in the two cointegrating equations and the constant
term in the first, all the parameters are significant at the 5% level. We can refit the model with the
Johansen normalization and the overidentifying constraint that the coefficient on kentucky in the
second cointegrating equation is zero.
. constraint define 1 [_ce1]missouri = 1
. constraint define 2 [_ce1]indiana = 0
. constraint define 3 [_ce2]missouri = 0
. constraint define 4 [_ce2]indiana = 1
. constraint define 5 [_ce2]kentucky = 0
10 vec — Vector error-correction models
_ce1
missouri 1 . . . . .
indiana 0 (omitted)
kentucky .2521685 .1649653 1.53 0.126 -.0711576 .5754946
illinois -1.037453 .1734165 -5.98 0.000 -1.377343 -.6975626
_cons -.3891102 .4726968 -0.82 0.410 -1.315579 .5373586
_ce2
missouri 0 (omitted)
indiana 1 . . . . .
kentucky 0 (omitted)
illinois -1.314265 .0907071 -14.49 0.000 -1.492048 -1.136483
_cons 2.937016 .6448924 4.55 0.000 1.67305 4.200982
The test of the overidentifying restriction does not reject the null hypothesis that the restriction
is valid, and the p-value on the coefficient on kentucky in the first cointegrating equation indicates
that it is not significant. We will leave the variable in the model and attribute the lack of significance
to whatever caused the kentucky series to temporarily rise above the others from 1985 until 1990,
though we could instead consider removing kentucky from the model.
Next, we look at the estimates of the adjustment parameters. In the output below, we replay
the previous results. We specify the alpha option so that vec will display an estimation table for
the estimates of the adjustment parameters, and we specify nobtable to suppress the table for the
parameters of the cointegrating equations because we have already looked at those.
vec — Vector error-correction models 11
D_missouri
_ce1
L1. -.0683152 .0185763 -3.68 0.000 -.1047242 -.0319063
_ce2
L1. .0405613 .0112417 3.61 0.000 .018528 .0625946
D_indiana
_ce1
L1. -.0342096 .0220955 -1.55 0.122 -.0775159 .0090967
_ce2
L1. .0325804 .0133713 2.44 0.015 .0063732 .0587877
D_kentucky
_ce1
L1. -.0482012 .0231633 -2.08 0.037 -.0936004 -.0028021
_ce2
L1. .0374395 .0140175 2.67 0.008 .0099657 .0649133
D_illinois
_ce1
L1. .0138224 .0227041 0.61 0.543 -.0306768 .0583215
_ce2
L1. .0567664 .0137396 4.13 0.000 .0298373 .0836955
All the coefficients are significant at the 5% level, except those on Indiana and Illinois in the first
cointegrating equation. From an economic perspective, the issue is whether the unemployment rates
in Indiana and Illinois adjust when the first cointegrating equation is out of equilibrium. We could
impose restrictions on one or both of those parameters and refit the model, or we could just decide
to use the current results.
12 vec — Vector error-correction models
Technical note
vec can be used to fit models in which the parameters in β are not identified, in which case only
the parameters in Π and the moving-average impact matrix C are identified. When the parameters in
β are not identified, the values of β
b and α
b can vary depending on the starting values. However, the
estimates of Π and C are identified and have known asymptotic distributions. This method is valid
because these additional normalization restrictions impose no restriction on Π or C.
trend(trend) allows for a linear trend in the cointegrating equations and a quadratic trend in
the undifferenced data. A linear trend in the cointegrating equations implies that the cointegrating
equations are assumed to be trend stationary.
trend(rtrend) defines a restricted trend model that excludes linear trends in the differenced data
but allows for linear trends in the cointegrating equations. As in the previous case, a linear trend in
a cointegrating equation implies that the cointegrating equation is trend stationary.
trend(constant) defines a model with an unrestricted constant. This allows for a linear trend
in the undifferenced data and cointegrating equations that are stationary around a nonzero mean. This
is the default.
trend(rconstant) defines a model with a restricted constant in which there is no linear or
quadratic trend in the undifferenced data. A nonzero µ allows for the cointegrating equations to be
stationary around nonzero means, which provide the only intercepts for differenced data. Seasonal
indicators are not allowed with this specification.
trend(none) defines a model that does not include a trend or a constant. When there is no trend
or constant, the cointegrating equations are restricted to being stationary with zero means. Also, after
adjusting for the effects of lagged endogenous variables, the differenced data are modeled as having
mean zero. Seasonal indicators are not allowed with this specification.
vec — Vector error-correction models 13
Technical note
vec uses a switching algorithm developed by Boswijk (1995) to maximize the log-likelihood
function when constraints are placed on the parameters. The starting values affect both the ability of
the algorithm to find a maximum and its speed in finding that maximum. By default, vec uses the
parameter estimates that correspond to Johansen’s normalization. Sometimes, other starting values
will cause the algorithm to find a maximum faster.
To specify starting values for the parameters in α, we specify a 1 × (K ∗ r) matrix in the afrom()
option. Specifying starting values for the parameters in β is slightly more complicated. As explained
in Methods and formulas, specifying trend(constant), trend(rtrend), or trend(trend) causes
some of the estimates of the trend parameters appearing in β b to be “backed out”. The switching
algorithm estimates only the parameters of the cointegrating equations whose estimates are stored in
e(betavec). For this reason, only the parameters stored in e(betavec) can have their initial values
set via bfrom().
The table below describes which trend parameters in the cointegrating equations are estimated by
the switching algorithm for each of the five specifications.
Trend specification Trend parameters in Trend parameter estimated
cointegrating equations via switching algorithm
none none none
rconstant cons cons
constant cons none
rtrend cons, trend trend
trend cons, trend none
Collinearity
As expected, collinearity among variables causes some parameters to be unidentified numerically.
If vec encounters perfect collinearity among the dependent variables, it exits with an error.
In contrast, if vec encounters perfect collinearity that appears to be due to too many lags in the
model, vec displays a warning message and reduces the maximum lag included in the model in an
effort to find a model with fewer lags in which all the parameters are identified by the data. Specifying
the noreduce option causes vec to skip over these additional checks and corrections for collinearity.
Thus the noreduce option can be used to force the estimation to proceed when not all the parameters
are identified by the data. When some parameters are not identified because of collinearity, the results
cannot be interpreted but can be used to find the source of the collinearity.
14 vec — Vector error-correction models
Stored results
vec stores the following in e():
Scalars
e(N) number of observations
e(k rank) number of unconstrained parameters
e(k eq) number of equations in e(b)
e(k dv) number of dependent variables
e(k ce) number of cointegrating equations
e(n lags) number of lags
e(df m) model degrees of freedom
e(ll) log likelihood
e(chi2 res) value of test of overidentifying restrictions
e(df lr) degrees of freedom of the test of overidentifying restrictions
e(beta iden) 1 if the parameters in β are identified and 0 otherwise
e(beta icnt) number of independent restrictions placed on β
e(k #) number of variables in equation #
e(df m#) model degrees of freedom in equation #
e(r2 #) R2 of equation #
e(chi2 #) χ2 statistic for equation #
e(rmse #) RMSE of equation #
e(aic) value of AIC
e(hqic) value of HQIC
e(sbic) value of BIC
e(tmin) minimum time
e(tmax) maximum time
e(detsig ml) determinant of the estimated covariance matrix
e(rank) rank of e(V)
e(converge) 1 if the switching algorithm converged, 0 if it did not converge
Macros
e(cmd) vec
e(cmdline) command as typed
e(trend) trend specified
e(tsfmt) format of the time variable
e(tvar) variable denoting time within groups
e(endog) endogenous variables
e(covariates) list of covariates
e(eqnames) equation names
e(cenames) names of cointegrating equations
e(reduce opt) noreduce, if noreduce is specified
e(reduce lags) list of maximum lags to which the model has been reduced
e(title) title in estimation output
e(aconstraints) constraints placed on α
e(bconstraints) constraints placed on β
e(sindicators) seasonal indicator variables
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) estimates of short-run parameters
e(V) VCE of short-run parameter estimates
e(beta) estimates of β
e(V beta) VCE of β b
e(betavec) directly obtained estimates of β
e(pi) estimates of Π
b
e(V pi) VCE of Π b
e(alpha) estimates of α
e(V alpha) VCE of α b
vec — Vector error-correction models 15
e(omega) estimates of Ω
b
e(mai) estimates of C
e(V mai) VCE of C b
Functions
e(sample) marks estimation sample
Note that results stored in r() are updated when the command is replayed and will be replaced when
any r-class command is run after the estimation command.
p−1
X
∆yt = αβ0 yt−1 + Γi ∆yt−i + v + δt + w1 s1 + · · · + wm sm + t (1)
i=1
where
yt is a K × 1 vector of endogenous variables,
α is a K × r matrix of parameters,
β is a K × r matrix of parameters,
Γ1 , . . . , Γp−1 are K × K matrices of parameters,
v is a K × 1 vector of parameters,
δ is a K × 1 vector of trend coefficients,
t is a linear time trend,
s1 , . . . , sm are orthogonalized seasonal indicators specified in the sindicators() option, and
w1 , . . . , wm are K × 1 vectors of coefficients on the orthogonalized seasonal indicators.
16 vec — Vector error-correction models
There are two types of deterministic elements in (1): the trend, v + δt, and the orthogonalized
seasonal terms, w1 s1 + · · · + wm sm . Johansen (1995, chap. 11) shows that inference about the
number of cointegrating equations is based on nonstandard distributions and that the addition of any
term that generalizes the deterministic specification in (1) changes the asymptotic distributions of the
statistics used for inference on the number of cointegrating equations and the asymptotic distribution
of the ML estimator of the cointegrating equations. In fact, Johansen (1995, 84) notes that including
event indicators causes the statistics used for inference on the number of cointegrating equations to
have asymptotic distributions that must be computed case by case. For this reason, event indicators
may not be specified in the present version of vec.
If seasonal indicators are included in the model, they cannot be collinear with a constant term. If
they are collinear with a constant term, one of the indicator variables is omitted.
As discussed in Specification of constants and trends, we can reparameterize the model as
p−1
X
∆yt = α(βyt−1 + µ + ρt) + Γi ∆yt−i + γ + τ t + t (2)
i=1
e 0 Z1t + ΨZ2t + t
Z0t = αβ (3)
e have rank r.
with the constraints that α and β
Johansen (1995, chap. 6), building on Anderson (1951), shows how the Ψ parameters can be
e , and the data, yielding the concentrated log-likelihood function
expressed as analytic functions of α, β
1n
Lc = − T K ln(2π) + T ln(|Ω|)
2
T
e 0 R1t )0 Ω−1 (R0t − αβ
e 0 R1t )
X o
+ (R0t − αβ (5)
t=1
vec — Vector error-correction models 17
where
PT
Mij = T −1 t=1 Zit Z0jt , i, j ∈ {0, 1, 2};
R0t = Z0t − M02 M−1
22 Z2t ; and
R1t = Z1t − M12 M−1
22 Z2t .
Unrestricted trend
When the trend in the VEC model is unrestricted, we can define the variables in (3) directly in
terms of the variables in (1):
Z1t = yt−1 is K × 1
0 0
Z2t = (∆yt−1 , . . . , ∆yt−p+1 , 1, t, s1 , . . . , sm )0 is {K(p − 1) + 2 + m} × 1;
Ψ = (Γ1 , . . . , Γp−1 , v, δ, w1 , . . . , wm ) is K × {K(p − 1) + 2 + m}
e = β is the K × r matrix composed of the r cointegrating vectors.
β
In the unrestricted trend specification, m1 = K, m2 = K(p − 1) + 2 + m, and there are
nparms = Kr + Kr + K{K(p − 1) + 2 + m} parameters in (3).
Restricted trend
When there is a restricted trend in the VEC model in (2), τ = 0, but the intercept v = αµ + γ is
unrestricted. The VEC model with the restricted trend can be written as
p−1
0 yt−1 X
∆yt = α(β , ρ) + Γi ∆yt−i + v + w1 s1 + · · · + wm sm + t
t
i=1
Unrestricted constant
An unrestricted constant in the VEC model in (2) is equivalent to setting δ = 0 in (1), which can
be written in the form of (3) by defining
Z1t = yt−1 is (K × 1)
0 0
Z2t = (∆yt−1 , . . . , ∆yt−p+1 , 1, s1 , . . . , sm )0 is {K(p − 1) + 1 + m} × 1;
Ψ = (Γ1 , . . . , Γp−1 , v, w1 , . . . , wm ) is K × {K(p − 1) + 1 + m}
e = β is the K × r matrix composed of the r cointegrating vectors
β
18 vec — Vector error-correction models
Restricted constant
When there is a restricted constant in the VEC model in (2), it can be written in the form of (3)
by defining
0
0
Z1t = yt−1 , 1 is (K + 1) × 1
0 0
Z2t = (∆yt−1 , . . . , ∆yt−p+1 )0 is K(p − 1) × 1
Ψ = (Γ1 , . . . , Γp−1 ) is K × K(p − 1)
e = β0 , µ 0 is the (K + 1) × r matrix composed of the r cointegrating vectors and the r
β
constants in the cointegrating relations.
In the restricted trend specification, m1 = K + 1, m2 = K(p − 1), and there are nparms =
Kr + (K + 1)r + K{K(p − 1)} parameters in (3).
No trend
When there is no trend in the VEC model in (2), it can be written in the form of (3) by defining
Z1t = yt−1 is K × 1
0 0
Z2t = (∆yt−1 , . . . , ∆yt−p+1 )0 is K(p − 1) + m × 1
Ψ = (Γ1 , . . . , Γp−1 ) is K × K(p − 1)
e = β is K × r matrix of r cointegrating vectors
β
In the no-trend specification, m1 = K , m2 = K(p − 1), and there are nparms = Kr + Kr +
K{K(p − 1)} parameters in (3).
and
1 if i = j
n
vi0 S11 vj = (9)
0 otherwise
At the optimum the log-likelihood function with the Johansen identification restrictions can be expressed
in terms of T, K, S00 , and the r largest eigenvalues
r
1 n X o
Lc = − T K ln(2π) + K + ln(|S00 |) + ln(1 − λ
bi )
2 i=1
where the λ
bi are the eigenvalues that solve (7), (8), and (9).
Using the normalized β,
b we can then obtain the estimates
b = S01 β
α b 0 S11 β
b (β b )−1 (10)
and
b = S00 − α
Ω bβb 0 S10
E b 0y yt
et = β
b
20 vec — Vector error-correction models
The r series in Ee t are called the predicted, nondemeaned cointegrating equations because they still
b
contain the terms µ and ρ. We want to work with the predicted, demeaned cointegrating equations.
Thus we need estimates of µ and ρ. In the trend(rconstant) specification, the algorithm directly
produces the estimator µ b . Similarly, in the trend(rtrend) specification, the algorithm directly
produces the estimator ρb. In the remaining cases, to back out estimates of µ and ρ, we need estimates
of v and δ, which we can obtain by estimating the parameters of the following VAR model:
X p−1
∆yt = αE
e t−1 + Γi ∆yt−i + v + δt + w1 s1 + · · · + wm sm + t (11)
b
i=1
α0 α
b = (b
µ b 0v
b )−1 α b (12)
α0 α
b = (b
ρ b 0b
b )−1 α δ (13)
if they are not already in β
b and are included in the trend specification.
We then augment β
b y to
b 0f = (β
β b 0y , µ
b, ρ
b)
E b 0f (yt0 , 1, t)0
bt = β
We last obtain estimates of all the short-run parameters from the VAR model:
p−1
X
∆yt = αE
b t−1 + Γi ∆yt−i + γ + τt + w1 s1 + · · · + wm sm + t (14)
i=1
Because the estimator β b f converges in probability to its true value at a rate faster than T −1/2 , we
can take our estimated E b t−1 as given data in (14). This allows us to estimate the variance–covariance
(VCE) matrix of the estimates of the parameters in (14) by using the standard VAR VCE estimator.
Equation (11) can be used to obtain consistent estimates of all the parameters and of the VCE of all
the parameters, except v and δ. The standard VAR VCE of v b and bδ is incorrect because these estimates
converge at a faster rate. This is why it is important to use the predicted, demeaned cointegrating
equations, Eb t−1 , when estimating the short-run parameters and trend terms. In keeping with the
cointegration literature, vec makes a small-sample adjustment to the VCE estimator so that the divisor
is (T − d) instead of T , where d represents the degrees of freedom of the model. d is calculated as
the integer part of nparms /K, where nparms is the total number of freely estimated parameters in
the model.
In the trend(rconstant) specification, the estimation procedure directly estimates µ. For
trend(constant), trend(rtrend), and trend(trend), the estimates of µ are backed out us-
ing (12). In the trend(rtrend) specification, the estimation procedure directly estimates ρ. In the
trend(trend) specification, the estimates of ρ are backed out using (13). Because the elements of
the estimated VCE are readily available only when the estimates are obtained directly, when the trend
parameter estimates are backed out, their elements in the VCE for βb f are missing.
vec — Vector error-correction models 21
Π
b =α
bβb0
and its estimated VCE is given by
1 b ⊗ (β b0)
Ω bΣbBβ
(T − d)
The moving-average impact matrix C is estimated by
C
b =β
b ⊥ (b
α⊥ Γ
bβ b 0⊥
b ⊥ )−1 α
R0evec(β
e) = b (18)
β
vec(β
e ) = Hb + h0 (20)
Using ρjacob , we can calculate several other parameter counts of interest. In particular, the degrees of
freedom of the overidentifying test are given by (K + m1 − r)r − ρjacob , and the number of freely
estimated parameters in the model is nparms = Km2 + ρjacob .
Although the problem of maximizing the log-likelihood function in (4), subject to the constraints in
(17) and (18), could be handled by the algorithms in [R] ml, the switching algorithm of Boswijk (1995)
has proven to be more convergent. For this reason, vec uses the Boswijk (1995) switching algorithm
to perform the optimization.
vec — Vector error-correction models 23
b b −1
α0j Ω
b j+1 = {H0 (b
j αb j ⊗ S11 )H}−1 H0 (b b −1
αj Ω j ⊗ S11 ){vec(P) − (b
b αj ⊗ InZ1 )h0 }
a b −1
bj+1 = {G(Ω j ⊗ βj S11 βj )G}
b b −1 0 b −1
G (Ωj ⊗ β
b j S11 )vec(P)
b
1
H{H0 (W ⊗ S11 )H}−1 H0
(T − d)
−1
where W is α b 0Ω
b αb . As in the case without constraints, the estimated VCE of αb can be obtained
either from the VCE of the short-run parameters, as described below, or via the formula
" #
1 n −1 0
o−1
0 b
b = (T − d) G G Ω ⊗ (β S11 β)G
Vbα b b G0
Boswijk (1995) notes that, as long as the parameters of the cointegrating equations are exactly
identified or overidentified, the constrained ML estimator produces superconsistent estimates of β.
e
This implies that the method of estimating the short-run parameters described above applies in the
presence of constraints, as well, albeit with a caveat: when there are constraints placed on α, the
VAR models must be estimated subject to these constraints.
With these estimates and the estimated VCE of the short-run parameter matrix V
b , Drukker (2004)
bν
shows that the estimated VCE for Π is given by
b
b ⊗ IK )Vb (β 0
(β b ⊗ IK )
b
α
Drukker (2004) also shows that the estimated VCE of C b can be obtained from (16) with the extension
that Vb
b
ν is the estimated VCE of νb that takes into account any constraints on α
b.
24 vec — Vector error-correction models
where nparms is the total number of parameters in the model and L is the value of the log likelihood
at the optimum.
levels causes predict to compute the predictions for the levels of the data. Let ybtd be the
predicted value of ∆yt . Because the computations are performed for a given equation, yt is a scalar.
Using ybtd , we can predict the level by ybt = ybtd + yt−1 .
Because the residuals from the VEC model for the differences and the residuals from the corresponding
VAR model in levels are identical, there is no need for an option for predicting the residuals in levels.
References
Anderson, T. W. 1951. Estimating linear restrictions on regression coefficients for multivariate normal distributions.
Annals of Mathematical Statistics 22: 327–351. https://doi.org/10.1214/aoms/1177729580.
Baum, C. F., and S. Hurn. 2021. Environmental Econometrics Using Stata. College Station, TX: Stata Press.
Becketti, S. 2020. Introduction to Time Series Using Stata. Rev. ed. College Station, TX: Stata Press.
Boswijk, H. P. 1995. Identifiability of cointegrated systems. Discussion Paper #95-78, Tinbergen Institute.
http://hdl.handle.net/11245/1.112017.
Boswijk, H. P., and J. A. Doornik. 2004. Identifying, estimating and testing restricted cointegrating systems: An
overview. Statistica Neerlandica 58: 440–465. https://doi.org/10.1111/j.1467-9574.2004.00270.x.
Box-Steffensmeier, J. M., J. R. Freeman, M. P. Hitt, and J. C. W. Pevehouse. 2014. Time Series Analysis for the
Social Sciences. New York: Cambridge University Press.
Drukker, D. M. 2004. Some further results on estimation and inference in the presence of constraints on alpha in a
cointegrating VECM. Working paper, StataCorp.
vec — Vector error-correction models 25
Du, K. 2017. Econometric convergence test and club clustering using Stata. Stata Journal 17: 882–900.
Engle, R. F., and C. W. J. Granger. 1987. Co-integration and error correction: Representation, estimation, and testing.
Econometrica 55: 251–276. https://doi.org/10.2307/1913236.
Hamilton, J. D. 1994. Time Series Analysis. Princeton, NJ: Princeton University Press.
Johansen, S. 1988. Statistical analysis of cointegration vectors. Journal of Economic Dynamics and Control 12:
231–254. https://doi.org/10.1016/0165-1889(88)90041-3.
. 1991. Estimation and hypothesis testing of cointegration vectors in Gaussian vector autoregressive models.
Econometrica 59: 1551–1580. https://doi.org/10.2307/2938278.
. 1995. Likelihood-Based Inference in Cointegrated Vector Autoregressive Models. Oxford: Oxford University
Press.
Jordan, S., and A. Q. Philips. 2018. Cointegration testing and dynamic simulations of autoregressive distributed lag
models. Stata Journal 18: 902–923.
Maddala, G. S., and I.-M. Kim. 1998. Unit Roots, Cointegration, and Structural Change. Cambridge: Cambridge
University Press.
Park, J. Y., and P. C. B. Phillips. 1988. Statistical inference in regressions with integrated processes: Part I. Econometric
Theory 4: 468–497. https://doi.org/10.1017/S0266466600013402.
. 1989. Statistical inference in regressions with integrated processes: Part II. Econometric Theory 5: 95–131.
https://doi.org/10.1017/S0266466600012287.
Phillips, P. C. B. 1986. Understanding spurious regressions in econometrics. Journal of Econometrics 33: 311–340.
https://doi.org/10.1016/0304-4076(86)90001-1.
Phillips, P. C. B., and S. N. Durlauf. 1986. Multiple time series regressions with integrated processes. Review of
Economic Studies 53: 473–495. https://doi.org/10.2307/2297602.
Pickup, M. 2015. Introduction to Time Series Analysis. Thousand Oaks, CA: Sage.
Rothenberg, T. J. 1971. Identification in parametric models. Econometrica 39: 577–591. https://doi.org/10.2307/1913267.
Sims, C. A., J. H. Stock, and M. W. Watson. 1990. Inference in linear time series models with some unit roots.
Econometrica 58: 113–144. https://doi.org/10.2307/2938337.
Stock, J. H. 1987. Asymptotic properties of least squares estimators of cointegrating vectors. Econometrica 55:
1035–1056. https://doi.org/10.2307/1911260.
Stock, J. H., and M. W. Watson. 1988. Testing for common trends. Journal of the American Statistical Association
83: 1097–1107. https://doi.org/10.1080/01621459.1988.10478707.
Watson, M. W. 1994. Vector autoregressions and cointegration. In Vol. 4 of Handbook of Econometrics, ed. R. F.
Engle and D. L. McFadden. Amsterdam: Elsevier. https://doi.org/10.1016/S1573-4412(05)80016-9.
Also see
[TS] vec postestimation — Postestimation tools for vec
[TS] tsset — Declare data to be time-series data
[TS] var — Vector autoregressive models+
[TS] var svar — Structural vector autoregressive models
[TS] vec intro — Introduction to vector error-correction models
[U] 20 Estimation and postestimation commands
Stata, Stata Press, and Mata are registered trademarks of StataCorp LLC. Stata and
®
Stata Press are registered trademarks with the World Intellectual Property Organization
of the United Nations. StataNow and NetCourseNow are trademarks of StataCorp
LLC. Other brand and product names are registered trademarks or trademarks of their
respective companies. Copyright c 1985–2023 StataCorp LLC, College Station, TX,
USA. All rights reserved.
For suggested citations, see the FAQ on citing Stata documentation.