@SWDOLS computes the DOLS (dynamic OLS) estimator for cointegrating vectors from Stock and Watson(1993). The dynamic regressions are estimated by OLS equation by equation with the right-hand-side endogenous variable(s), a constant (and trend if requested) and current, leads and lags of the differenced RHS endogenous variable(s) as explanatory variables. The first variables in the list of endogenous variables are put on the left side of the regression, up to the number in the specified rank. (Thus, with the default of RANK=1, it's estimated with the first listed variable on the left side).

Note that this can very quickly run you out of degrees of freedom if the number of variables times the LAGS option (which controls the number of leads and lags of the differences) is large.

@JOHMLE can be used for testing and estimating cointegrated system. @FM is an alternative which does fully modified least squares, but can only handle a single cointegrating vector.

@SWDOLS( options )   start end

# list of endogenous variables


This is included as one of estimators in the Cointegration Estimation Wizard on the Time Series menu.


start, end

estimation range. By default, the maximum range over which all variables are defined allowing for lags and leads.


RANK=number of cointegrating vectors to estimate [1]

This estimates "rank" equations, with the first "rank" endogenous variables used as the LHS variables of these, while the remaining endogenous variables are the RHS variables.

ECT=VECT[EQUATION] of equations describing the cointegrating vectors

You can use this to define a VECT[EQUATION] with the cointegrating relations. This can be used directly in the ECT subcommand used in defining and estimating a VECM.

LAGS=number of leads and lags of the differences of the RHS variables to include [1]

This is in addition to the current level and the current difference. Note that each additional lag takes two data points out of the data set (one lag and one lead) and adds two regressors per RHS variable. As a result, you can very quickly run out of degrees of freedom with increasing lags, particularly if the number of RHS variables is high.


Deterministic components to include

AR=number of lags in the AR(VAR if rank>1) used in computing the spectral density matrix at 0 frequency.

This affects the covariance matrix, but not the point estimates. This is different from the LAGS option above, and has no effect on the degrees of freedom in the regression.

TITLE="title for report" ["Dynamic OLS Estimates"]

Variables Defined


Cointegrating vector(s) (only, augmenting variables aren't included). If the rank is greater than 1, it's a stacked vector with the cointegrating vector including the first endogenous variable first, followed by the one for the second, etc. (VECTOR)


Covariance matrix of the cointegrating vectors(s) organized as described under %BETA (SYMMETRIC)

Testing Restrictions

After using @SWDOLS, you can use TEST, RESTRICT or MRESTRICT to test hypotheses on the cointegrating vector(s). (These are Wald tests, using the estimation coefficients and covariance matrix). See the example. If the rank is more than 1, the position numbers are in the stacked vector of coefficients.



* Replication file for King, Plosser, Stock and Watson(1991),

* "Stochastic Trends and Economic Fluctuations", AER, vol 81, pp 819-840.


* This file includes analysis for table 2


open data kpswdata.rat

calendar(q) 1947

data(format=rats) 1947:1 1988:4 c in y mp dp r

set igapy = in-y

set cgapy = c-y

set realr = r-400*dp


@swdols(lags=5,ar=4) 1954:1 *

# mp y r

test(title="Velocity Restriction")

# 1 2

# 1.0 0.0

The output for this is shown below.

An example with rank>1 is


# c in y

which will estimate cointegrating vectors of the forms c = betac * y and in = betai * y. (Rank=2, so the first two endogenous variables are used on the LHS and the remaining variable is on the RHS).

Sample Output

With RANK=1 (the default), the first endogenous variable (MP) is used as the left side variable, while the other two are used as right side variables.

The output shows only the estimated cointegrating relationships, omitting the constant and lags and leads of the differenced variables. The values in (...) are standard errors.

Dynamic OLS Estimates

Estimated from 1954:01 to 1987:03

Lags/Leads Used in Dynamic Regressions: 5

AR Lags in Computing S(0): 4

Using Constant as deterministic component


Y   1.19701

 ( 0.06180)

R  -0.01343

 ( 0.00377)