Open Access
This article is

- freely available
- re-usable

*Econometrics*
**2017**,
*5*(2),
19;
doi:10.3390/econometrics5020019

Article

Maximum Likelihood Estimation of the I(2) Model under Linear Restrictions

Department of Economics and Institute for New Economic Thinking at the Oxford Martin School, University of Oxford, Oxford, OX1 3UQ, UK

*

Correspondence: jurgen.doornik@nuffield.ox.ac.uk

Academic Editor:
Katarina Juselius

Received: 27 February 2017 / Accepted: 8 May 2017 / Published: 15 May 2017

## Abstract

**:**

Estimation of the I(2) cointegrated vector autoregressive (CVAR) model is considered. Without further restrictions, estimation of the I(1) model is by reduced-rank regression (Anderson (1951)). Maximum likelihood estimation of I(2) models, on the other hand, always requires iteration. This paper presents a new triangular representation of the I(2) model. This is the basis for a new estimation procedure of the unrestricted I(2) model, as well as the I(2) model with linear restrictions imposed.

Keywords:

cointegration; I(2); vector autoregression; representation; maximum likelihood estimation; reduced rank regression; generalized least squaresJEL Classification:

C32; C51; C61## 1. Introduction

The I(1) model or cointegrated vector autoregression (CVAR) is now well established. The model is developed in a series of papers and books (see, e.g., Johansen (1988), Johansen (1991), Johansen (1995a), Juselius (2006)) and generally available in econometric software. The I(1) model is formulated as a rank reduction of the matrix of ‘long-run’ coefficients. The Gaussian log-likelihood is estimated by reduced-rank regression (RRR; see Anderson (1951), Anderson (2002)).

Determining the cointegrating rank only finds the cointegrating vectors up to a rank-preserving linear transformation. Therefore, the next step of an empirical study usually identifies the cointegrating vectors. This may be followed by imposing over-identifying restrictions. Common restrictions, i.e., the same restrictions on each cointegrating vector, can still be solved by adjusting the RRR estimation; see Johansen and Juselius (1990) and Johansen and Juselius (1992). Estimation with separate linear restrictions on the cointegrating vectors, or more general non-linear restrictions, requires iterative maximization. The usual approach is based on so-called switching algorithms; see Johansen (1995b) and Boswijk and Doornik (2004). The former proposes an algorithm that alternates between cointegrating vectors, estimating one while keeping the others fixed. The latter consider algorithms that alternate between the cointegrating vectors and their loadings: when one is kept fixed, the other is identified. The drawback is that these algorithms can be very slow and occasionally terminate prematurely. Doornik (2017) proposes improvements that can be applied to all switching algorithms.

Johansen (1995c) and Johansen (1997) extend the CVAR to allow for I(2) stochastic trends. These tend to be smoother than I(1) stochastic trends. The I(2) model implies a second reduced rank restriction, but this is now more complicated, and estimation under Gaussian errors can no longer be performed by RRR. The basis of an algorithm for maximum likelihood estimation is presented in Johansen (1997), with an implementation in Dennis and Juselius (2004).

The general approach to handling the I(2) model is to create representations that introduce parameters that vary freely without changing the nature of the model. This facilitates both the statistical analysis and the estimation.

The contributions of the current paper are two-fold. First, we present the triangular representation of the I(2) model. This is a new trilinear formulation with a block-triangular matrix structure at its core. The triangular representation provides a convenient framework for imposing linear restrictions on the model parameters. Next, we introduce several improved estimation algorithms for the I(2) model. A simulation experiment is used to study the behaviour of the algorithms.

#### Notation

Let $\alpha $ ($p\times r$) be a matrix with full column rank $r,r\le p$. The perpendicular matrix ${\alpha}_{\u221f}$ ($p\times p\phantom{\rule{-0.166667em}{0ex}}-\phantom{\rule{-0.166667em}{0ex}}r$) has ${\alpha}_{\u221f}^{\prime}\alpha =0$. The orthogonal complement ${\alpha}_{\perp}$ has ${\alpha}_{\perp}^{\prime}\alpha =0$ with the additional property that ${\alpha}_{\perp}^{\prime}{\alpha}_{\perp}={I}_{p-r}$. Define $\tilde{\alpha}=\alpha {\left({\alpha}^{\prime}\alpha \right)}^{-1/2}$ and $\overline{\alpha}=\alpha {\left({\alpha}^{\prime}\alpha \right)}^{-1}$. Then, $(\tilde{\alpha}:{\alpha}_{\perp})$ is a $p\times p$ orthogonal matrix, so ${I}_{p}=\tilde{\alpha}{\tilde{\alpha}}^{\prime}+{\alpha}_{\perp}{\alpha}_{\perp}^{\prime}=\overline{\alpha}{\alpha}^{\prime}+{\alpha}_{\perp}{\alpha}_{\perp}^{\prime}=\alpha {\overline{\alpha}}^{\prime}+{\alpha}_{\perp}{\alpha}_{\perp}^{\prime}$.

The (thin) singular value decomposition (SVD) of $\alpha $ is $\alpha =UW{V}^{\prime}$, where $U(p\times r),V(r\times r)$ are orthogonal: ${U}^{\prime}U={V}^{\prime}V=V{V}^{\prime}={I}_{r}$, and W is a diagonal matrix with the ordered positive singular values on the diagonal. If rank$\left(\alpha \right)=s<r$, then the last $r-s$ singular values are zero. We can find ${\alpha}_{\perp}={U}_{2}$ from the SVD of the square matrix $(\alpha :0)=({U}_{1}:{U}_{2})W{V}^{\prime}=({U}_{1}{W}_{1}{V}_{1}^{\prime}:0)$.

The (thin) QR factorization of $\alpha $ with pivoting is $\alpha P=QR$, with $Q(p\times r)$ orthogonal and R upper triangular. This pivoting is the reordering of columns of $\alpha $ to better handle poor conditioning and singularity, and is captured in P, as discussed Golub and Van Loan (2013, §5.4.2).

The QL decomposition of A can be derived from the QR decomposition of $JAJ$: $JAJ=QR$, so $A=JJAJJ=JQJJZJ={Q}^{\prime}L$. J is the exchange matrix, which is the identity matrix with columns in reverse order: premultiplication reverses rows; postmultiplication reverses columns; and $JJ=I$.

Let $\overline{\overline{\alpha}}={\Omega}^{-1}\alpha {\left({\alpha}^{\prime}{\Omega}^{-1}\alpha \right)}^{-1}$, then ${\alpha}_{\perp}^{\prime}\Omega \overline{\overline{\alpha}}=0$.

Finally, $a\leftarrow b$ assigns the value of b to a.

## 2. The I(2) Model

The vector autoregression (VAR) with p dependent variables and $m\ge 1$ lags:
for $t=1,...,T$, and with ${y}_{j},j=-m+1,...,0$ fixed and given, can be written in equilibrium correction form as:
without imposing any restrictions. The I(1) cointegrated VAR (CVAR) imposes a reduced rank restriction on ${\Pi}_{y}(p\times p)$: rank${\Pi}_{y}=r$; see, e.g., Johansen and Juselius (1990), Johansen (1995a).

$${y}_{t}={A}_{1}{y}_{t-1}+...+{A}_{m}{y}_{t-m}+\Phi {x}_{t}^{U}+{\u03f5}_{t},\phantom{\rule{1.em}{0ex}}{\u03f5}_{t}\sim {\mathrm{IIN}}_{p}[{0}_{p},\Omega ],$$

$$\Delta {y}_{t}={\Pi}_{y}{y}_{t-1}+{\Gamma}_{1}\Delta {y}_{t-1}+...+{\Gamma}_{m-1}\Delta {y}_{t-m+1}+\Phi {x}_{t}^{U}+{\u03f5}_{t},$$

With $m\ge 2$, the model can be written in second-differenced equilibrium correction form as:
The I(2) CVAR involves an additional reduced rank restriction:
where ${\alpha}_{\perp}^{\prime}\alpha =0.$ The two rank restrictions can be expressed more conveniently in terms of products of matrices with reduced dimensions:
where $\alpha $ and ${\beta}_{y}$ are $p\times r$ matrices. The second restriction needs rank s, so $\xi $ and ${\eta}_{y}$ are a $(p-r)\times s$. This requires that the matrices on the right-hand side of (2) and (3) have full column rank. The number of I(2) trends is ${s}_{2}=p-r-s$.

$${\Delta}^{2}{y}_{t}={\Pi}_{y}{y}_{t-1}-{\Gamma}_{y}\Delta {y}_{t-1}+{\Psi}_{1}{\Delta}^{2}{y}_{t-1}+...+{\Psi}_{m-2}{\Delta}^{2}{y}_{t-m+2}+\Phi {x}_{t}^{U}+{\u03f5}_{t}.$$

$$\begin{array}{cc}\hfill \mathrm{rank}\left({\alpha}_{\perp}^{\prime}{\Gamma}_{y}{\beta}_{y,\perp}\right)& =s,\hfill \end{array}$$

$$\begin{array}{cc}\hfill {\Pi}_{y}& =\alpha {\beta}_{y}^{\prime},\hfill \end{array}$$

$$\begin{array}{cc}\hfill {\alpha}_{\perp}^{\prime}{\Gamma}_{y}{\beta}_{y,\perp}& =\xi {\eta}_{y}^{\prime},\hfill \end{array}$$

The most relevant model in terms of deterministics allows for linearly trending behaviour: $\Phi {x}_{t}^{U}={\mu}_{0}+{\mu}_{1}t$ . Using the representation theorem of Johansen (1992) and assuming $\mathsf{E}\left[{y}_{t}\right]=a+bt$ imply:
which restricts and links ${\mu}_{0}$ and ${\mu}_{1}$; we see that ${\alpha}_{\perp}^{\prime}{\mu}_{1}=0$ and ${\alpha}_{\perp}^{\prime}{\mu}_{0}={\alpha}_{\perp}^{\prime}{\Gamma}_{y}b$.

$$\begin{array}{cc}\hfill {\mu}_{1}& =-\alpha {\beta}_{y}^{\prime}b,\hfill \end{array}$$

$$\begin{array}{cc}\hfill {\mu}_{0}& =-\alpha {\beta}_{y}^{\prime}a+{\Gamma}_{y}b,\hfill \end{array}$$

#### 2.1. The I(2) Model with a Linear Trend

The model (1) subject to the I(1) and I(2) rank restrictions (2) and (3) with $\Phi {x}_{t}^{U}={\mu}_{0}+{\mu}_{1}t$, subject to (4) and (5) can be written as:
subject to:
where $\beta $ is ${p}_{1}\times r$, $\Gamma $ is $p\times {p}_{1}$ and $\eta $ is $({p}_{1}-r)\times s$. In this case, ${p}_{1}=p+1$. Because $\alpha $ is the leading term in (4), we can extend ${\beta}_{y}$ by introducing ${\beta}_{c}^{\prime}=-{\beta}_{y}^{\prime}b$, so ${\beta}^{\prime}=({\beta}_{y}^{\prime}:{\beta}_{c}^{\prime})$. Furthermore, $\Gamma $ has been extended to $\Gamma =({\Gamma}_{y}:{\Gamma}_{c})=({\Gamma}_{y}:-{\mu}_{0})$.

$${\Delta}^{2}{y}_{t}=\alpha {\beta}^{\prime}\left(\begin{array}{c}{y}_{t-1}\\ t\end{array}\right)-\Gamma \left(\begin{array}{c}\Delta {y}_{t-1}\\ 1\end{array}\right)+{\Psi}_{1}{\Delta}^{2}{y}_{t-1}+...+{\Psi}_{m-2}{\Delta}^{2}{y}_{t-m+2}+{\u03f5}_{t},$$

$${\alpha}_{\perp}^{\prime}\Gamma {\beta}_{\perp}=\xi {\eta}^{\prime},$$

To see that (6) and (7) remains the same I(2) model, consider ${\alpha}_{\perp}^{\prime}{\Gamma}_{c}$ and insert ${I}_{p}={\beta}_{y}{\overline{\beta}}_{y}^{\prime}+{\beta}_{y\perp}{\beta}_{y\perp}^{\prime}$:
Using the perpendicular matrix:
we see that the rank condition is unaffected:

$$\begin{array}{cc}\hfill {\alpha}_{\perp}^{\prime}{\Gamma}_{c}& =-{\alpha}_{\perp}^{\prime}{\Gamma}_{y}{\overline{\beta}}_{y}{\beta}_{y}^{\prime}b-{\alpha}_{\perp}^{\prime}{\Gamma}_{y}{\beta}_{y\perp}{\beta}_{y\perp}^{\prime}b={\alpha}_{\perp}^{\prime}{\Gamma}_{y}{\overline{\beta}}_{y}{\beta}_{c}^{\prime}-\xi {\eta}_{y}^{\prime}{\beta}_{y\perp}^{\prime}b={\alpha}_{\perp}^{\prime}{\Gamma}_{y}{\overline{\beta}}_{y}{\beta}_{c}^{\prime}+\xi {\eta}_{c}^{\prime}.\hfill \end{array}$$

$${\beta}_{{\displaystyle \u221f}}=\left(\begin{array}{cc}{\beta}_{y\perp}& -{\overline{\beta}}_{y}{\beta}_{c}^{\prime}\\ 0& 1\end{array}\right)$$

$${\alpha}_{\perp}^{\prime}\Gamma {\beta}_{{\displaystyle \u221f}}=\left({\alpha}_{\perp}^{\prime}{\Gamma}_{y}{\beta}_{y\perp}:\xi {\eta}_{c}^{\prime}\right)=\left({\alpha}_{\perp}^{\prime}{\Gamma}_{y}{\beta}_{y\perp}:{\alpha}_{\perp}^{\prime}[-{\Gamma}_{y}{\overline{\beta}}_{y}{\beta}_{c}^{\prime}+{\Gamma}_{c}]\right)=\xi \left({\eta}_{y}^{\prime}:{\eta}_{c}^{\prime}\right).$$

A more general formulation allows for restricted deterministic and weakly exogenous variables ${x}_{t}^{R}$ and unrestricted variables ${x}_{t}^{U}$:
where ${\Delta}^{2}{x}_{t}^{R}$, and its lags are contained in ${x}_{t}^{U}$; this in turn, is subsumed under ${w}_{3t}={({\Delta}^{2}{y}_{t-1}^{\prime},...,{x}_{t}^{U\prime})}^{\prime}$. The number of variables in ${x}_{t}^{R}$ is ${p}_{1}-p$, so $\Pi $ and $\Gamma $ always have the same dimensions. $\Psi $ is unrestricted, which allows it to be concentrated out by regressing all other variables on ${w}_{3t}$:

$$\begin{array}{cc}\hfill {\Delta}^{2}{y}_{t}& =\Pi \left(\begin{array}{c}{y}_{t-1}\\ {x}_{t-1}^{R}\end{array}\right)-\Gamma \left(\begin{array}{c}\Delta {y}_{t-1}\\ \Delta {x}_{t}^{R}\end{array}\right)+{\Psi}_{1}{\Delta}^{2}{y}_{t-1}+...+{\Psi}_{m-2}{\Delta}^{2}{y}_{t-m+2}+\Phi {x}_{t}^{U}+{\u03f5}_{t},\hfill \\ & =\Pi {w}_{2t}-\Gamma {w}_{1t}+\Psi {w}_{3t}+{\u03f5}_{t},\hfill \end{array}$$

$${z}_{0t}=\alpha {\beta}^{\prime}{z}_{2t}-\Gamma {z}_{1t}+{\u03f5}_{t},\phantom{\rule{1.em}{0ex}}{\u03f5}_{t}\sim {\mathrm{IIN}}_{p}[{0}_{p},\Omega ].$$

To implement likelihood-ratio tests, it is necessary to count the number of restrictions:
defining ${s}_{2}^{*}={p}_{1}-r-s$. The restrictions on $\Pi $ follow from the representation. Several representations of the I(2) model have been introduced in the literature to translate the implicit non-linear restriction (3) on $\Gamma $ into an explicit part of the model. These representations reveal the number of restrictions imposed on $\Gamma $, as is shown below.

$$\begin{array}{ccc}\mathrm{restrictions}\phantom{\rule{4.pt}{0ex}}\mathrm{on}\phantom{\rule{4.pt}{0ex}}\Pi :\hfill & \hfill (p-r)({p}_{1}-r)& \mathrm{restrictions},\hfill \\ \mathrm{restrictions}\phantom{\rule{4.pt}{0ex}}\mathrm{on}\phantom{\rule{4.pt}{0ex}}\Gamma :\hfill & \hfill (p-r-s)({p}_{1}-r-s)={s}_{2}{s}_{2}^{*}& \mathrm{restrictions},\hfill \end{array}$$

First, we introduce the new triangular representation.

#### 2.2. The Triangular Representation

**Theorem**

**1.**

Consider the model:
with rank restrictions $\Pi =\alpha {\beta}^{\prime}$ and ${\alpha}_{\perp}^{\prime}\Gamma {\beta}_{\perp}=\xi {\eta}^{\prime}$ where α is a $p\times r$ matrix, β is ${p}_{1}\times r$, ξ is $(p-r)\times s$, η is $({p}_{1}-r)\times s$. This can be written as:
where:
$A,B,{W}_{11},{V}_{22}$ are full rank matrices. A is $p\times p$, and B is ${p}_{1}\times {p}_{1}$; moreover, A, B and the nonzero blocks in W and V are freely varying. A and B are partitioned as:
where the blocks in A have ${s}_{2},s,r$ columns respectively; for B, this is: $r,s,{s}_{2}^{*}$; ${p}_{1}=r+s+{s}_{2}^{*}$. W and V are partitioned accordingly.

$${z}_{0t}=\Pi {z}_{2t}-\Gamma {z}_{1t}+{\u03f5}_{t},$$

$${z}_{0t}=AW{B}^{\prime}{z}_{2t}-AV{B}^{\prime}{z}_{1t}+{\u03f5}_{t},$$

$$W=\left(\begin{array}{ccc}0& 0& 0\\ 0& 0& 0\\ {W}_{11}& 0& 0\end{array}\right),\phantom{\rule{1.em}{0ex}}V=\left(\begin{array}{ccc}{V}_{31}& 0& 0\\ {V}_{21}& {V}_{22}& 0\\ {V}_{11}& {V}_{12}& {V}_{13}\end{array}\right).$$

$$A=\left({A}_{2}:{A}_{1}:{A}_{0}\right),\phantom{\rule{1.em}{0ex}}B=\left({B}_{0}:{B}_{1}:{B}_{2}\right),$$

**Proof.**

Write $\tilde{\alpha}=\alpha {\left({\alpha}^{\prime}\alpha \right)}^{-1/2}$, such that ${\tilde{\alpha}}^{\prime}\tilde{\alpha}={I}_{r}$. Construct A and B as:
Now, ${A}^{\prime}A=I$ and ${B}^{\prime}B=I$. $A(p\times p)$ and $B({p}_{1}\times {p}_{1})$ are full rank by design. Define $V={A}^{\prime}\Gamma B$:
${V}_{22}={\left({\xi}^{\prime}\xi \right)}^{\frac{1}{2}}{\left({\eta}^{\prime}\eta \right)}^{\frac{1}{2}}$ is a full rank $s\times s$ matrix. The zero blocks in V arise because, e.g., ${\xi}_{\perp}^{\prime}{\alpha}_{\perp}^{\prime}\Gamma {\beta}_{\perp}={\xi}_{\perp}^{\prime}\xi {\eta}^{\prime}=0$. Trivially:
${W}_{11}={\left({\alpha}^{\prime}\alpha \right)}^{\frac{1}{2}}{\left({\beta}^{\prime}\beta \right)}^{\frac{1}{2}}$ is a full rank $r\times r$ matrix. Both W and V are $p\times {p}_{1}$ matrices. Because A and B are each orthogonal: $\Gamma =A{A}^{\prime}\Gamma B{B}^{\prime}=AV{B}^{\prime}.$

$$A=\left({\alpha}_{\perp}{\xi}_{\perp}:{\alpha}_{\perp}\tilde{\xi}:\tilde{\alpha}\right),\phantom{\rule{1.em}{0ex}}B=\left(\tilde{\beta}:{\beta}_{\perp}\tilde{\eta}:{\beta}_{\perp}{\eta}_{\perp}\right).$$

$$V=\left(\begin{array}{ccc}{\xi}_{\perp}^{\prime}{\alpha}_{\perp}^{\prime}\Gamma \tilde{\beta}& {\xi}_{\perp}^{\prime}{\alpha}_{\perp}^{\prime}\Gamma {\beta}_{\perp}\tilde{\eta}& {\xi}_{\perp}^{\prime}{\alpha}_{\perp}^{\prime}\Gamma {\beta}_{\perp}{\eta}_{\perp}\\ {\tilde{\xi}}^{\prime}{\alpha}_{\perp}^{\prime}\Gamma \tilde{\beta}& {\tilde{\xi}}^{\prime}{\alpha}_{\perp}^{\prime}\Gamma {\beta}_{\perp}\tilde{\eta}& {\tilde{\xi}}^{\prime}{\alpha}_{\perp}^{\prime}\Gamma {\beta}_{\perp}{\eta}_{\perp}\\ {\tilde{\alpha}}^{\prime}\Gamma \tilde{\beta}& {\tilde{\alpha}}^{\prime}\Gamma {\beta}_{\perp}\tilde{\eta}& {\tilde{\alpha}}^{\prime}\Gamma {\beta}_{\perp}{\eta}_{\perp}\end{array}\right)=\left(\begin{array}{ccc}{V}_{31}& 0& 0\\ {V}_{21}& {V}_{22}& 0\\ {V}_{11}& {V}_{12}& {V}_{13}\end{array}\right).$$

$$\Pi =\alpha {\beta}^{\prime}=A\left(\begin{array}{ccc}0& 0& 0\\ 0& 0& 0\\ {W}_{11}& 0& 0\end{array}\right){B}^{\prime}=AW{B}^{\prime}.$$

The QR decomposition shows that a full rank square matrix can be written as the product of an orthogonal matrix and a triangular matrix. Therefore, $AV{B}^{\prime}=A{L}_{a}{L}_{a}^{-1}V{L}_{b}{L}_{b}^{-1}{B}^{\prime}={A}_{*}{V}_{*}{B}_{*}^{\prime}$ preserves the structure in ${V}_{*}$ when ${L}_{a},{L}_{b}$ are lower triangular, as well as that in ${W}_{*}$. This shows that (9) holds for any full rank A and B, and the orthogonality can be relaxed.

Therefore, any model with full rank matrices A and B, together with any $W,V$ that have the zeros as described above, satisfies the I(2) rank restrictions. We obtain the same model by restricting A and B to be orthogonal. ☐

When $\Gamma $ is restricted only by the I(2) condition: rank$\Gamma =r+s+min(r,{s}_{2})$. Then, V varies freely, except for the zero blocks, and the I(2) restrictions are imposed through the trilinear form of (9). $\Gamma =0$ implies $V=0$. Another way to have $s=0$ is $\Gamma =(\alpha :0)G$; in that case, $V\ne 0$.

The ${s}_{2}$ restrictions on the intercept (5) can be expressed as ${A}_{2}^{\prime}({\mu}_{0}-{\mu}_{c})=0,$ using ${\mu}_{c}={\Gamma}_{y}{\overline{\beta}}_{y}{\beta}_{c}^{\prime}$, or ${\mu}_{0}=({A}_{1}:{A}_{0})v+{\mu}_{c},$ for a vector v of length $r+s$.

#### 2.3. Obtaining the Triangular Representation

The triangular representation shows that the I(2) model can be written in trilinear form:
where A and B are freely varying, provided W and V have the appropriate structure.

$${z}_{0t}=AW{B}^{\prime}{z}_{2t}-AV{B}^{\prime}{z}_{1t}+{\u03f5}_{t},$$

Consider that we are given $\alpha ,\beta ,\Gamma $ of an I(2) CVAR with rank indices $r,s$ and wish to obtain the parameters of the triangular representation. First compute ${\alpha}_{\perp}^{\prime}\Gamma {\beta}_{\perp}=\xi {\eta}^{\prime}$, which can be done with the SVD, assuming rank s. From this, compute A and B:
Then, $V={A}^{-1}\Gamma {B}^{-1\prime}$. Because $\Gamma $ satisfies the I(2) rank restriction, V will have the corresponding block-triangular structure.

$$A=({A}_{2}:{A}_{1}:{A}_{0})=\left({\alpha}_{\perp}{\xi}_{\perp}:{\alpha}_{\perp}\tilde{\xi}:\alpha \right),\phantom{\rule{1.em}{0ex}}B=({B}_{0}:{B}_{1}:{B}_{2})=\left(\beta :{\beta}_{\perp}\tilde{\eta}:{\beta}_{\perp}{\eta}_{\perp}\right).$$

It may be of interest to consider which part of the structure can be retrieved in the case where rank$(\Pi )=r$, but rank$({\alpha}_{\perp}^{\prime}\Gamma {\beta}_{\perp})=p-r$, while it should be s. This would happen when using I(1) starting values for I(2) estimation. The off anti-diagonal blocks of zeros:
can be implemented with two sweep operations:
The offsetting operations affect ${A}_{1}$ and ${B}_{1}$ only, so $\Pi $ and $\Gamma $ are unchanged. However, we cannot achieve ${V}_{33}=0$ in a similar way, because it would remove the zeros just obtained. The ${V}_{33}$ block has dimension ${s}_{2}{s}_{2}^{*}$ and represents the number of restrictions imposed on $\Gamma $ in the I(2) model. Similarly, the anti-diagonal block of zeros in W captures the restrictions on $\Pi $.

$${V}^{*}=\left(\begin{array}{ccc}{V}_{31}^{*}& {V}_{32}^{*}& {V}_{33}^{*}\\ {V}_{21}& {V}_{22}& {V}_{23}^{*}\\ {V}_{11}& {V}_{12}& {V}_{13}^{*}\end{array}\right)\phantom{\rule{1.em}{0ex}}\to \phantom{\rule{1.em}{0ex}}\left(\begin{array}{ccc}{V}_{31}& 0& {V}_{33}\\ {V}_{21}& {V}_{22}& 0\\ {V}_{11}& {V}_{12}& {V}_{13}\end{array}\right)=V$$

$$\left(\begin{array}{ccc}{I}_{{s}_{2}}& -{V}_{32}^{*}{V}_{22}^{-1}& 0\\ 0& {I}_{s}& 0\\ 0& 0& {I}_{r}\end{array}\right){V}^{*}\left(\begin{array}{ccc}{I}_{r}& 0& 0\\ 0& {I}_{s}& -{V}_{22}^{-1}{V}_{23}^{*}\\ 0& 0& {I}_{{s}_{2}^{*}}\end{array}\right).$$

Note that the $r\times {s}_{2}^{*}$ block ${V}_{13}$ can be made lower triangular. Write the column partition of V as $({V}_{\xb71}:{V}_{\xb72}:{V}_{\xb73})$, and use ${V}_{13}=LQ$ to replace ${V}_{\xb73}$ by ${V}_{\xb73}{Q}^{\prime}$ and ${B}_{2}$ by ${B}_{2}{Q}^{\prime}$. When $r<{s}_{2}^{*}$, the rightmost ${s}_{2}^{*}-r$ columns of L will be zero, and the corresponding columns of ${B}_{2}$ are not needed to compute $\Gamma $. This part can then be omitted from the likelihood evaluation. This is an issue when we propose an estimation procedure in §4.2.1.

#### 2.4. Restoring Orthogonality

Although A and B are freely varying, interpretation may require orthogonality between column blocks. The column blocks of A are in reverse order from B to make V and W block lower triangular. As a consequence, multiplication of V or W from either side by a lower triangular matrix preserves their structure. This allows for the relaxation of the orthogonality of A and B, but also enables us to restore it again.

To restore orthogonality, let $\Gamma ={A}_{*}{V}_{*}{B}_{*}^{\prime}$, where ${A}_{*},{B}_{*}$ are not orthogonal, but with ${V}_{*}$ block-triangular. Now, use the QL decomposition to get ${A}_{*}=AL$, with A orthogonal and L lower triangular. Use the QR decomposition to get ${B}_{*}=BR$, with B orthogonal and R upper triangular. Then, ${A}_{*}{V}_{*}{B}_{*}^{\prime}=AL{V}_{*}{R}^{\prime}{B}^{\prime}=AV{B}^{\prime}$ with the blocks of zeros in V preserved. ${A}_{*}{W}_{*}{B}_{*}^{\prime}$ must be adjusted accordingly. When $\beta $ is restricted, ${B}_{0}$ cannot be modified like this. However, we can still adjust $({A}_{2}:{A}_{1})={A}_{*}$ to get ${A}_{*}^{\prime}{A}_{*}={I}_{p-r}$ and ${A}_{0}^{\prime}{A}_{*}=0$; with similar adjustments to $({B}_{1}:{B}_{2})$.

The orthogonal version is convenient mathematically, but for estimation, it is preferable to use the unrestricted version. We do not distinguish through notation, but the context will state when the orthogonal version is used.

#### 2.5. Identification in the Triangular Representation

The matrices A and B are not identified without further restrictions. For example, rescaling $\alpha $ and $\beta $ as in $\alpha {W}_{11}{\beta}^{\prime}={\alpha}^{\prime}{c}^{-1}c{W}_{11}d{d}^{-1}\beta ={\alpha}^{*}c{W}_{11}d{\beta}^{*\prime}$ can be absorbed in V:
When $\beta $ is identified, ${W}_{11}$ remains freely varying, and we can, e.g., set $c={W}_{11}^{-1}$. However, it is convenient to transform to ${W}_{11}=I$, so that ${A}_{0}$ and ${B}_{0}$ correspond to $\alpha $ and $\beta $. This prevents part of the orthogonality, in the sense that ${A}_{0}^{\prime}{A}_{0}\ne I$ and ${B}_{0}^{\prime}{B}_{0}\ne I$.

$$\left(\begin{array}{ccc}{V}_{31}d& 0& 0\\ {V}_{21}d& {V}_{22}& 0\\ c{V}_{11}d& c{V}_{12}& c{V}_{13}\end{array}\right).$$

The following scheme identifies A and B, under the assumption that ${B}_{0}$ is already identified through prior restrictions.

- Orthogonalize to obtain ${A}_{0}^{\prime}{A}_{1}=0,{A}_{0}^{\prime}{A}_{2}=0,{A}_{1}^{\prime}{A}_{2}=0$.
- Choose s full rank rows from ${B}_{1}$, denoted ${M}_{{B}_{1}}$, and set ${B}_{1}\leftarrow {B}_{1}{M}_{{B}_{1}}^{-1}$. Adjust V accordingly.
- Do the same for ${B}_{2}\leftarrow {B}_{2}{M}_{{B}_{2}}^{-1}$.
- Set ${A}_{1}\leftarrow {A}_{1}{V}_{22}$, ${V}_{21}\leftarrow {V}_{22}^{-1}{V}_{21}$ and ${V}_{22}\leftarrow I$.
- ${A}_{2}\leftarrow {A}_{2}{M}_{{A}_{2}}^{-1}$.

## 3. Relation to Other Representations

Two other formulations of the I(2) model that are in use are the so-called $\tau $ and $\delta $ representations. All representations implement the same model and make the rank restrictions explicit. However, they differ in their definitions of freely-varying parameters, so may facilitate different forms of analysis, e.g., asymptotic analysis, estimation or the imposition of restrictions. The different parametrizations may also affect economic interpretations.

#### 3.1. $\tau $ Representation

Johansen (1997) transforms (8) into the $\tau $-representation:
where $\varrho ({p}_{1}\times r\phantom{\rule{-0.166667em}{0ex}}+\phantom{\rule{-0.166667em}{0ex}}s)$ is used to recover $\beta $: $\beta =\tau \varrho $. The parameters $(\alpha ,\varrho ,\tau ,\psi ,\kappa )$ vary freely. If we normalize on ${\varrho}^{\prime}=({I}_{r}:0)$ and adjust $\kappa ,\tau $ accordingly, then $\tau =(\beta :{\beta}_{1})$, and:

$${z}_{0t}=\alpha \left({\varrho}^{\prime}{\tau}^{\prime}{z}_{2t}+{\psi}^{\prime}{z}_{1t}\right)+w{\kappa}^{\prime}{\tau}^{\prime}{z}_{1t}+{\u03f5}_{t},$$

$${z}_{0t}=\alpha \left({\beta}^{\prime}{z}_{2t}+{\psi}^{\prime}{z}_{1t}\right)+w{\kappa}^{\prime}{\tau}^{\prime}{z}_{1t}+{\u03f5}_{t}.$$

We shall derive the $\tau $ representation. The first step is to define a transformation of ${\u03f5}_{t}\sim \mathrm{N}[0,\Omega ]$:
This splits the p-variate systems into two independent parts. The first has any terms with leading $\alpha $ knocked out, while the second has all leading $\alpha $’s cancelled. The inverse transformation is given by: ${({\alpha}_{\perp}:\overline{\overline{\alpha}})}^{-1}={({\alpha}_{\perp}-\alpha {\overline{\overline{\alpha}}}^{\prime}{\alpha}_{\perp}:\alpha )}^{\prime}={(w:\alpha )}^{\prime}.$

$${\left(\begin{array}{cc}{\alpha}_{\perp}& \overline{\overline{\alpha}}\end{array}\right)}^{\prime}{\u03f5}_{t}\sim \mathrm{N}\left[0,\left(\begin{array}{cc}{\alpha}_{\perp}^{\prime}\Omega {\alpha}_{\perp}& 0\\ 0& {\left({\alpha}^{\prime}{\Omega}^{-1}\alpha \right)}^{-1}\end{array}\right)\right].$$

The next step is to apply (13) to (8) to create two independent systems and insert ${I}_{p}=\overline{\beta}{\beta}^{\prime}+{\beta}_{\perp}{\beta}_{\perp}^{\prime}$ in the ‘marginal’ equation:
where ${\psi}^{\prime}=-{\overline{\overline{\alpha}}}^{\prime}\Gamma $ and ${\kappa}^{\prime}=-({\alpha}_{\perp}^{\prime}\Gamma \overline{\beta}:\xi )$ are freely varying. Removing the transformation:
and introducing the additional parameters $\tau =(\beta :{\beta}_{\perp}\eta )$ and $\varrho $ completes the $\tau $-representation (12). Table 1 provides definitions of the parameters that are used (cf. Johansen (1997, Tables 1 and 2)).

$${\left(\begin{array}{cc}{\alpha}_{\perp}& \overline{\overline{\alpha}}\hfill \end{array}\right)}^{\prime}{z}_{0t}=\left\{\begin{array}{cc}-{\alpha}_{\perp}^{\prime}\Gamma (\overline{\beta}{\beta}^{\prime}+{\beta}_{\perp}{\beta}_{\perp}^{\prime}){z}_{1t}+{\epsilon}_{1t}\hfill & ={\kappa}^{\prime}{(\beta :{\beta}_{\perp}\eta )}^{\prime}{z}_{1t}+{\epsilon}_{1t},\hfill \\ {\beta}^{\prime}{z}_{2t}-{\overline{\overline{\alpha}}}^{\prime}\Gamma {z}_{1t}+{\epsilon}_{2t}\hfill & ={\beta}^{\prime}{z}_{2t}+{\psi}^{\prime}{z}_{1t}+{\epsilon}_{2t}.\hfill \end{array}\right.$$

$${z}_{0t}={w}^{\prime}{\kappa}^{\prime}{(\beta :{\beta}_{\perp}\eta )}^{\prime}{z}_{1t}+{\alpha}^{\prime}({\beta}^{\prime}{z}_{2t}+{\psi}^{\prime}{z}_{1t})+{\u03f5}_{t}$$

**Corollary**

**1.**

**Proof.**

Write ${A}_{*}=({A}_{2}:{A}_{1})$, so $A=({A}_{*}:{A}_{0})$. First, the system (9) is premultiplied by ${A}^{-1}={\overline{A}}^{\prime}$ and subsequently with a lower triangular matrix L to create two independent subsystems. The matrix L and its inverse are given by:
where ${w}_{*}=\Omega {\overline{A}}_{*}{({\overline{A}}_{*}^{\prime}\Omega {\overline{A}}_{*})}^{-1}$, cf. (14). Because ${A}_{0}^{\prime}{A}_{*}=0$, we have that ${A}_{*}+{A}_{0}{\overline{A}}_{0}^{\prime}{w}_{*}={A}_{*}+{(I-{A}_{*}{\overline{A}}_{*})}^{\prime}{w}_{*}={w}_{*}$, so $A{L}^{-1}=({w}_{*}:{A}_{0})$. Furthermore: $LW=W$. The identity matrix ${L}^{-1}L$ can also be inserted directly in (9):
where ${\psi}^{\prime}=-{\overline{A}}_{0}^{\prime}{w}_{*}({V}_{11}:{V}_{12}:{V}_{13}){B}^{\prime}$ and $w{\kappa}^{\prime}=-{w}_{*}\left(\begin{array}{cc}{V}_{31}& 0\\ {V}_{21}& {V}_{22}\end{array}\right).$ ☐

$$L=\left(\begin{array}{cc}{I}_{p-r}& 0\\ -{\overline{A}}_{0}^{\prime}{w}_{*}& {I}_{r}\end{array}\right),\phantom{\rule{1.em}{0ex}}{L}^{-1}=\left(\begin{array}{cc}{I}_{p-r}& 0\\ {\overline{A}}_{0}^{\prime}{w}_{*}& {I}_{r}\end{array}\right),$$

$$\begin{array}{cc}\hfill {z}_{0t}& ={A}_{0}{W}_{11}{B}_{0}^{\prime}{z}_{2t}-({w}_{*}:{A}_{0})LV{B}^{\prime}{z}_{1t}+{\u03f5}_{t}\hfill \\ & ={A}_{0}{W}_{11}{B}_{0}^{\prime}{z}_{2t}-{w}_{*}\left(\begin{array}{cc}\hfill {V}_{31}& \hfill 0\\ \hfill {V}_{21}& \hfill {V}_{22}\end{array}\right){({B}_{0}:{B}_{1})}^{\prime}{z}_{1t}+{A}_{0}{\overline{A}}_{0}^{\prime}{w}_{*}({V}_{11}:{V}_{12}:{V}_{13}){B}^{\prime}{z}_{1t}+{\u03f5}_{t}\hfill \\ & =\alpha \left[{\beta}^{\prime}{z}_{2t}+{\psi}^{\prime}{z}_{1t}\right]+w{\kappa}^{\prime}{\tau}^{\prime}{z}_{1t}+{\u03f5}_{t},\hfill \end{array}$$

#### 3.2. $\delta $ Representation

Paruolo and Rahbek (1999) and Paruolo (2000a) use the $\delta $ representation:
Here, $(\alpha ,\delta ,\zeta ,\tau =[\beta :{\beta}_{1}])$ vary freely. To derive the $\delta $ representation, use $\overline{\tau}{\tau}^{\prime}+{\tau}_{\perp}{\tau}_{\perp}^{\prime}={I}_{r+s}$:
and insert in (8). The term with ${\alpha}_{\perp}^{\prime}\Gamma {\tau}_{\perp}$ disappears because ${\tau}_{\perp}={\beta}_{\perp}{\eta}_{\perp}$, so ${\alpha}_{\perp}^{\prime}\Gamma {\tau}_{\perp}=\xi {\eta}^{\prime}{\eta}_{\perp}=0$.

$${z}_{0t}=\alpha \left({\beta}^{\prime}{z}_{2t}+\delta {\tau}_{\perp}^{\prime}{z}_{1t}\right)+\zeta {\tau}^{\prime}{z}_{1t}+{\u03f5}_{t}.$$

$$\begin{array}{cc}\hfill -\Gamma \overline{\tau}{\tau}^{\prime}& =-(\Gamma \overline{\beta}:\Gamma {\beta}_{\perp}\overline{\eta}){\tau}^{\prime}=({\zeta}_{1}:{\zeta}_{2}){\tau}^{\prime}=\zeta {\tau}^{\prime},\hfill \\ \hfill -\Gamma {\tau}_{\perp}{\tau}_{\perp}^{\prime}& =-\alpha {\overline{\alpha}}^{\prime}\Gamma {\tau}_{\perp}{\tau}_{\perp}^{\prime}-{\alpha}_{\perp}{\alpha}_{\perp}^{\prime}\Gamma {\tau}_{\perp}{\tau}_{\perp}^{\prime}=\alpha \delta {\tau}_{\perp}^{\prime},\hfill \end{array}$$

When $\beta $ is identified both $\delta {\tau}_{\perp}^{\prime}$ and $\zeta {\tau}^{\prime}$ are unique, but not yet $\zeta $ or $\delta $. In the $\tau $ representation, the variable $\psi $ is also unique with $\varrho $ chosen as ${(I:0)}^{\prime}$ and $\beta $ identified. Table 2 relates the $\tau $, $\delta $ and triangular representations.

**Corollary**

**2.**

**Proof.**

Write ${B}_{2}={\tau}_{\u221f}$ and $({B}_{0}:{B}_{1})=\tau $. Using the column partitioning if $V=({V}_{.1}:{V}_{.2}:{V}_{.3})$: $\Gamma \overline{\tau}=AV{B}^{\prime}\overline{\tau}=A({V}_{.1}:{V}_{.2})$. From (9):
☐

$$\begin{array}{cc}\hfill {z}_{0t}& ={A}_{0}\left[{W}_{11}{B}_{0}^{\prime}{z}_{2t}-{V}_{13}{\tau}_{{\displaystyle \u221f}}^{\prime}{z}_{1t}\right]-A({V}_{.1}:{V}_{.2}){\tau}^{\prime}{z}_{1t}+{\u03f5}_{t}\hfill \\ & ={A}_{0}\left[{W}_{11}{B}_{0}^{\prime}{z}_{2t}-{V}_{13}{\tau}_{{\displaystyle \u221f}}^{\prime}{z}_{1t}\right]-\Gamma \overline{\tau}{\tau}^{\prime}{z}_{1t}+{\u03f5}_{t}=\alpha \left[{\beta}^{\prime}{z}_{2t}+\delta {\tau}_{\perp}^{\prime}{z}_{1t}\right]+\zeta {\tau}^{\prime}{z}_{1t}+{\u03f5}_{t}.\hfill \end{array}$$

## 4. Algorithms for Gaussian Maximum Likelihood Estimation

Algorithms to estimate the Gaussian CVAR are usually alternating over sets of variables. In the cointegration literature, these are called switching algorithms, following Johansen and Juselius (1994).

The advantage of switching is that each step is easy to implement, and no derivatives are required. Furthermore, the partitioning circumvents the lack of identification that can occur in these models and which makes it harder to use Newton-type methods. The drawback is that progress is often slow, taking many iterations to converge. Occasionally, this will lead to premature convergence. Although the steps can generally be shown to be in a non-downward direction, this is not enough to show convergence to a stationary point. The work in Doornik (2017) documents the framework for the switching algorithms and also considers acceleration of these algorithms; both results are used here.

Johansen (1997, §8) proposes an algorithm based on the $\tau $-representation, called $\tau $-switching here. This is presented in detail in Appendix B. Two new algorithms are given next, the first based on the $\delta $-representation, the second on the triangular representation. Some formality is required to describe the algorithms with sufficient detail.

#### 4.1. $\delta $-Switching Algorithm

The free parameters in the $\delta $-representation (15) are $(\alpha ,\delta ,\zeta ,\tau )$ with symmetric positive definite $\Omega $. The algorithm alternates between estimating $\tau $ given the rest and fixing $\tau $. The model for $\tau $ given the other parameters is linear:

- To estimate $\tau =[\beta :{\beta}_{1}]$, rewrite (15) as:$${z}_{0t}=\alpha {\beta}^{\prime}{z}_{2t}+{\zeta}_{1}{\beta}^{\prime}{z}_{1t}+{\zeta}_{2}{\beta}_{1}^{\prime}{z}_{1t}+\alpha d{z}_{1t}+{\u03f5}_{t},$$$${z}_{0t}=(\alpha \otimes {z}_{2t}^{\prime}+{\zeta}_{1}\otimes {z}_{1t}^{\prime})\mathrm{vec}\beta +({\zeta}_{2}\otimes {z}_{1t}^{\prime})\mathrm{vec}{\beta}_{1}+\left(\alpha \otimes {z}_{1t}^{\prime}\right)\mathrm{vec}\left({d}^{\prime}\right)+{\u03f5}_{t}.$$We can treat d as a free parameter in (16). First, when $r\ge {s}_{2}^{*}$, $\delta $ has more parameters than ${\tau}_{\perp}$. Second, when $r<{s}_{2}^{*}$, then $\Gamma $ is reduced rank, and ${s}_{2}^{*}-r$ columns of ${\tau}_{\perp}$ are redundant. Orthogonality is recovered in the next step.
- Given $\tau $ and derived ${\tau}_{\perp}$, we can estimate $\alpha $ and $\delta $ by RRR after concentrating out ${\tau}^{\prime}{z}_{1t}$. Introducing $\rho $ with dimension $(r\phantom{\rule{-0.166667em}{0ex}}+\phantom{\rule{-0.166667em}{0ex}}{s}_{2}^{*})\times r$ allows us to write (15) as:$${z}_{0t}={\alpha}^{*}{\rho}^{\prime}\left(\begin{array}{c}{\beta}^{\prime}{z}_{2t}\\ {\tau}_{\perp}^{\prime}{z}_{1t}\end{array}\right)+\zeta {\tau}^{\prime}{z}_{1t}+{\u03f5}_{t}.$$

The RRR step is the same as used in Dennis and Juselius (2004) and Paruolo (2000b). However, the GLS step for $\tau $ is different from both. We have found that the specification of the GLS step can have a substantial impact on the performance of the algorithm.

For numerical reasons (see, e.g. Golub and Van Loan (2013, Ch.5)), we prefer to use the QR decomposition to implement OLS and RRR estimation rather than moment matrices. However, in iterative estimation, there are very many regressions, which would be much faster using precomputed moment matrices. As a compromise, we use precomputed ‘data’ matrices that are transformed by a QR decomposition. This reduces the effective sample size from T to $2{p}_{1}$. The regressions (16) and (17) can then be implemented in terms of the transformed data matrices; see Appendix A.

Usually, starting values of $\alpha $ and $\beta $ are available from I(1) estimation. The initial $\tau $ is then obtained from the marginal equation of the $\tau $-representation, (14a), written as:
RRR of ${\alpha}_{\perp}^{\prime}{z}_{0t}$ on ${\beta}_{\perp}^{\prime}{z}_{1t}$ corrected for ${\beta}^{\prime}{z}_{1t}$ gives estimates of $\eta $, and so, $\tau $.

$${\alpha}_{\perp}^{\prime}{z}_{0t}={\kappa}^{\prime}{\tau}^{\prime}{z}_{1t}+{\epsilon}_{1t}={\kappa}_{1}^{\prime}{\beta}^{\prime}{z}_{1t}+\xi {\eta}^{\prime}{\beta}_{\perp}^{\prime}{z}_{1t}+{\epsilon}_{1t}.$$

$\delta $-switching algorithm:

To start, set $k=1$, and choose starting values ${\alpha}^{\left(0\right)},{\beta}^{\left(0\right)}$, tolerance ${\epsilon}_{1}$ and the maximum number of iterations. Compute ${\tau}_{c}^{\left(0\right)}$ from (18) and ${\alpha}^{\left(0\right)},{\delta}^{\left(0\right)},{\zeta}^{\left(0\right)},{\Omega}^{\left(0\right)}$ from (17). Furthermore, compute ${f}^{\left(0\right)}=-log\left|{\Omega}^{\left(0\right)}\right|$.

- 1.
- 2.
- Compute ${f}_{c}^{\left(k\right)}=-log\left|{\Omega}_{c}^{\left(k\right)}\right|.$
- 3.
- Enter a line search for $\tau $.The change in $\tau $ is $\nabla ={\tau}_{c}^{\left(k\right)}-{\tau}^{(k-1)}$ and the line search find a step length $\lambda $ with ${\tau}^{\left(k\right)}={\tau}^{(k-1)}+\lambda \nabla $. Because only $\tau $ is varied, a GLS step is needed to evaluate the log-likelihood for each trial $\tau $. The line search gives new parameters with corresponding ${f}^{\left(k\right)}$.
- T.
- Compute the relative change from the previous iteration:$${c}^{\left(k\right)}=\frac{{f}^{\left(k\right)}-{f}^{(k-1)}}{1+\left|{f}^{(k-1)}\right|}.$$$$|{c}^{\left(k\right)}|\le {\epsilon}_{1}\phantom{\rule{4.pt}{0ex}}\mathrm{and}\phantom{\rule{4.pt}{0ex}}\underset{i,j}{max}\frac{\left|{\Pi}_{ij}^{\left(k\right)}-{\Pi}_{ij}^{(k-1)}\right|}{1+\left|{\Pi}_{ij}^{(k-1)}\right|}\le {\epsilon}_{1}^{1/2}.$$

The subscript c indicates that these are candidate values that may be improved upon by the line search. The line search is the concentrated version, so the I(2) equivalent to the LBeta line search documented in Doornik (2017). This means that the function evaluation inside the line search needs to re-evaluate all of the other parameters as $\tau $ changes. Therefore, within the line search, we effectively concentrate out all other parameters.

Normalization of $\tau $ prevents the scale from growing excessively, and it was found to be beneficial to normalize in the first iteration every hundredth or when the norm of $\tau $ gets large. Continuous normalization had a negative impact in our experiments. Care is required when normalizing: if an iteration uses a different normalization from the previous one, then the line search will only be effective if the previous coefficients are adjusted accordingly.

The algorithm is incomplete without starting values, and it is obvious that a better start will lead to faster and more reliable convergence. Experimentation also showed that this and other algorithms struggled more in cases with $s=0$. To improve this, we generate two initial values, follow three iterations of the $\tau $-switching algorithms, then select the best for continuation. The details are in Appendix C.

#### 4.2. MLE with the Triangular Representation

We set ${W}_{11}=I$. This tends to lead to slower convergence, but is required when both $\alpha $ and $\beta $ are restricted. ${V}_{22}$ is kept unrestricted: fewer restrictions seem to lead to faster convergence. All regressions use the data matrices that are pre-transformed by an orthogonal matrix as described in Appendix A. In the next section, we describe the estimation steps that can be repeated until convergence.

#### 4.2.1. Estimation Steps

Equation (9) provides a convenient structure for an alternating variables algorithm. We can solve three separate steps by ordinary or generalized least squares for the case with orthogonal A:

- B-step: estimate B, and fix $A,V,W,\Omega $ at ${A}_{c},{V}_{c},{W}_{c},{\Omega}_{c}$. The resulting model is linear in B:$${z}_{0t}={A}_{c}{W}_{c}{B}^{\prime}{z}_{2t}-{A}_{c}{V}_{c}{B}^{\prime}{z}_{1t}+{\epsilon}_{t}.$$$${H}^{\prime}{P}^{-1}{z}_{0t}=L{W}_{c}{B}^{\prime}{z}_{2t}-L{V}_{c}{B}^{\prime}{z}_{1t}+{u}_{t}={\tilde{W}}_{c}{B}^{\prime}{z}_{2t}-{\tilde{V}}_{c}{B}^{\prime}{z}_{1t}+{u}_{t},$$
- V-step: estimate $W,V,$, and fix $A,B,\Omega $. This is a linear model in $(W,V)$, which can be solved by GLS as in the B step.
- A-step: estimate $A,\Omega $ and fix $W,V,B$ at ${W}_{c},{V}_{c},{B}_{c}$:$${z}_{0t}=A\left({W}_{c}{B}_{c}^{\prime}{z}_{2t}-{V}_{c}{B}_{c}^{\prime}{z}_{1t}\right)+{\epsilon}_{t}$$

The likelihood will not go down when making one update that consists of the three steps given above, provided V is full rank. If that does not hold, as noted at the end of §2.3, some part of ${B}_{2}$ or ${A}_{2}$ is not identified from the above expressions. To handle this, we make the following adjustments to steps 1 and 3:

- 1a.
- B-step: Remove the last ${s}_{2}^{*}-min\{r,{s}_{2}^{*}\}$ columns from B, V and W, as they do not affect the log-likelihood. When iteration is finished, we can add columns of zeros back to W and V and the orthogonal complement of the reduced B to get a rectangular B.
- 3a.
- A-step: we wish to keep A invertible and, so, square during iteration. The missing part of ${A}_{2}$ is filled in with the orthogonal complement of the remainder of A after each regression. This requires re-estimation of ${V}_{.1}$ by OLS.

#### 4.2.2. Triangular-Switching Algorithm

The steps described in the previous section form the basis of an alternating variables algorithm:

Triangular-switching algorithm:

To start, set $k=1$, and choose ${\alpha}^{\left(0\right)},{\beta}^{\left(0\right)}$ and the maximum number of iterations. Compute ${A}^{\left(0\right)}$, ${B}^{\left(0\right)}$, ${V}^{\left(0\right)}$, ${W}^{\left(0\right)}$ and ${\Omega}^{\left(0\right)}$.

- 1.1
- B-step: obtain ${B}^{\left(k\right)}$ from ${A}^{(k-1)},{V}^{(k-1)},{W}^{(k-1)},{\Omega}^{(k-1)}$.
- 1.2
- V step: obtain ${W}^{\left(k\right)},{V}^{\left(k\right)}$ from ${A}^{(k-1)},{B}^{\left(k\right)},{\Omega}^{(k-1)}$.
- 1.3
- A step: obtain ${A}^{\left(k\right)},{\Omega}^{\left(k\right)}$ from ${B}^{\left(k\right)},{V}^{\left(k\right)},{W}^{\left(k\right)}$.
- 1.4
- ${V}_{.1}$ step: if necessary, obtain new ${V}_{.1}^{\left(k\right)}$ from ${A}^{\left(k\right)},{B}^{\left(k\right)},{V}_{.2}^{\left(k\right)},{V}_{.3}^{\left(k\right)},{W}^{\left(k\right)}$.
- 2...
- As steps 2,3,T from the $\delta $-switching algorithm. In this case, the line search is over all of the parameters in $A,B,V$. ☐

The starting values are taken as for the $\delta $-switching algorithm; see Appendix C. This means that two iterations of $\delta $-switching are taken first, using only restrictions on $\beta $.

#### 4.3. Linear Restrictions

#### 4.3.1. Delta Switching

Estimation under linear restrictions on $\beta $ or $\tau $ of the form:
can be done by adjusting the GLS step in §4.1. However, estimation of $\alpha $ is by RRR, which is not so easily adjusted for linear restrictions. Restricting $\delta $ requires replacing the RRR step by regression conditional on $\delta $, which makes the algorithm much slower. Estimation under $\delta =0$, which implies $d=0$, is straightforward.

$$\beta =\left({H}_{1}{\varphi}_{1}:...:{H}_{r}{\varphi}_{r}\right)\phantom{\rule{4.pt}{0ex}}\mathrm{or}\phantom{\rule{4.pt}{0ex}}\tau =\left({H}_{1}{\varphi}_{1}:...:{H}_{r+s}{\varphi}_{r+s}\right)$$

#### 4.3.2. Triangular Switching

Triangular switching avoids RRR, and restrictions on $\beta ={B}_{0}$ or $\tau =({B}_{0}:{B}_{1})$ can be implemented by adjusting the B-step. In general, we can test restrictions of the form:
Such linear restrictions on the columns of A and B are a straightforward extension of the GLS steps described above.

$$B=\left({H}_{1}{\varphi}_{1}:...:{H}_{{p}_{1}}{\varphi}_{{p}_{1}}\right)\phantom{\rule{4.pt}{0ex}}\mathrm{and}\phantom{\rule{4.pt}{0ex}}A=\left({G}_{1}{\theta}_{1}:...:{G}_{p}{\theta}_{p}\right).$$

Estimation without multi-cointegration is also feasible. Setting $\delta =0$ corresponds to ${V}_{13}=0$ in the triangular representation. This amounts to removing the last ${s}_{2}^{*}$ columns from $B,V,W$. Boswijk (2010) shows that the test for $\delta =0$ has an asymptotic ${\chi}^{2}\left(r{s}_{2}^{*}\right)$ distribution.

Paruolo and Rahbek (1999) derives conditions for weak exogeneity in (15). They decompose this into three sub-hypotheses: ${\mathcal{H}}_{0}\phantom{\rule{-0.166667em}{0ex}}\phantom{\rule{-0.166667em}{0ex}}:{b}^{\prime}\alpha =0$, ${\mathcal{H}}_{1}\phantom{\rule{-0.166667em}{0ex}}\phantom{\rule{-0.166667em}{0ex}}:{b}^{\prime}\left({\alpha}_{\perp}\xi \right)=0$, ${\mathcal{H}}_{2}\phantom{\rule{-0.166667em}{0ex}}\phantom{\rule{-0.166667em}{0ex}}:{b}^{\prime}{\zeta}_{1}=0$. These restrictions, taking $b={e}_{p,i}$, where ${e}_{p,i}$ is the i-th column of ${I}_{p}$, correspond to a zero right-hand side in a particular equation in the triangular representation. First is ${e}_{p,i}^{\prime}{A}_{0}=0$ creating a row of zeros in $AW{B}^{\prime}$. Next is ${e}_{p,i}^{\prime}{A}_{1}=0$, which extends the row of zeros. However, A must be full rank, so the final restriction must be imposed on V as ${e}_{p,i}^{\prime}AV=({e}_{p,i}^{\prime}{A}_{2}:0:0)V=0$, expressed as ${e}_{p,i}^{\prime}{A}_{2}{V}_{31}=0$. Paruolo and Rahbek (1999) shows that the combined test for a single variable has an asymptotic ${\chi}^{2}(2r+s)$ distribution.

## 5. Comparing Algorithms

We have three algorithms that can be compared:

- The $\delta $-switching algorithm, §4.1, which can handle linear restrictions on $\beta $ or $\tau $.
- The triangular-switching algorithm proposed in §4.2.2. This can optionally have linear restrictions on the columns of A or B.
- The improved $\tau $-switching algorithm, Appendix B, implemented to allow for common restrictions on $\tau $.

The comparisons are based on a model for the Danish data (five variables: ${m}_{3}=$ log real money, $y=$ log real GDP, $\Delta p=$ log GDP deflator, and ${r}_{m}$, ${r}_{b}$, two interest rates); see Juselius (2006, §4.1.1). This has two lags in the VAR, with an unrestricted constant and restricted trend for the deterministic terms, i.e., specification ${H}_{l}$. The sample period is 1973(3) to 2003(1). First computed is the I(2) rank test table.

Table 3 records the number of iterations used by each of the algorithms; this is closely related to the actual computational time required (but less machine specific). All three algorithms converge rapidly to the same likelihood value. Although $\tau $ switching takes somewhat fewer iterations, it tends to take a bit more time to run than the other two algorithms. The new triangular I(2) switching procedure is largely competitive with the new $\delta $-switching algorithm.

To illustrate the advances made with the new algorithms, we report in Table 4 how the original $\tau $-switching, as well as the CATS2 version of $\delta $-switching performed. CATS2, Dennis and Juselius (2004), is a RATS package for the estimation of I(1) and I(2) models, which uses a somewhat different implementation of an I(2) algorithm that is also called $\delta $-switching. The number of iterations of that CATS 2 algorithm is up to 200-times higher than that of the new algorithms, which are therefore much faster, as well as more robust and reliable.

## 6. A More Detailed Comparison

A Monte Carlo experiment is used to show the difference between algorithms in more detail. The first data generation process is the model for the Danish data, estimated with the I(1) and I(2) restrictions $r,s$ imposed. $M=1000$ random samples are drawn from this, using, for each case, the estimated parameters and estimated residual variance assuming normality. The number of iterations and the progress of the algorithm is recorded for each sample. The maximum number of iterations was set to 10 000, ${\u03f5}_{1}={10}^{-11}$, and all replications are included in the results.

Figure 1 shows the histograms of the number of iterations required to achieve convergence (or 10,000). Each graph has the number of iterations (on a log 10 scale) on the horizontal axis and the count (out of 1000 experiments) represented by the bars and the vertical axis. Ideally, all of the mass is to the left, reflecting very quick convergence. The top row of histograms is for $\delta $ switching, the bottom row for triangular switching. In each histogram, the data generation process (DGP) uses the stated $r,s$ values, and estimation is using the correct values of $r,s$.

The histograms show that triangular switching (bottom row) uses more iterations than $\delta $ switching (top row), in particular when $s=0$. Nonetheless, the experiment using triangular switching runs slightly faster as measured by the total time taken (and $\tau $ switching is the slowest).

An important question is whether the algorithms converge to the same maximum. The function value that is maximized is:

$$f\left(\theta \right)=-log|\Omega (\theta \left)\right|.$$

Out of 10,000 experiments, counted over all $r,s$ combinations that we consider, there is only a single experiment with a noticeable difference in $f(\widehat{\theta})$. This happens for $r=3,s=0$, and $\delta $-switching finds a higher function value by almost $0.05$. Because $T=119$, the $0.05$ translates to a difference of three in the log-likelihoods.

A second issue of interest is how the algorithms perform when restrictions are imposed. The following restrictions are imposed on the three columns of $\beta $ with $r=3$:
This specification identifies the cointegrating vectors and imposes two over-identifying restrictions. For $r=3,s=0$ this is accepted with a p-value of $0.4$, while for $r=3,s=1$, the p-value is $0.5$ using the model on the actual Danish data. Simulation is from the estimated restricted model.

$$\begin{array}{ccccccc}& \hfill {m}_{3}& \hfill y& \hfill \Delta p& \hfill {r}_{m}& \hfill {r}_{b}& \hfill t\\ {\beta}_{1}^{\prime}\hfill & \hfill a& \hfill -a& \hfill 0& \hfill 1& \hfill -1& \hfill \ast \\ {\beta}_{2}^{\prime}\hfill & \hfill 0& \hfill \ast & \hfill 1& \hfill -a& \hfill a& \hfill \ast \\ {\beta}_{3}^{\prime}\hfill & \hfill 0& \hfill 0& \hfill 1& \hfill \ast & \hfill 0& \hfill \ast \end{array}$$

In terms of the number of iterations, as Figure 2 shows, $\delta $-switching converges more rapidly in most cases. This makes triangular switching slower, but only by about $10\%$–$20\%$.

Figure 3 shows $f({\widehat{\theta}}_{\delta})-f({\widehat{\theta}}_{\mathrm{triangular}})$, so a positive value means that triangular switching obtained a lower log-likelihood. There are many small differences, mostly to the advantage of $\delta $-switching when $s=1$ (right-hand plot), but to the advantage of triangular switching on the left, when $s=0$. The latter case is also much more noisy.

#### 6.1. Hybrid Estimation

To increase the robustness of the triangular procedure, we also consider a hybrid procedure, which combines algorithms as follows:

- standard starting values, as well as twenty randomized starting values, then
- triangular switching, followed by
- BFGS optimization (the Broyden-Fletcher, Goldfarb, and Shanno quasi-Newton method) for a maximum of 200 iterations, followed by
- triangular switching.

This offers some protection against false convergence, because BFGS is based on first derivatives combined with an approximation to the inverse Hessian.

More importantly, we add a randomized search for better starting values as perturbations of the default starting values. Twenty versions of starting values are created this way, and each is followed for ten iterations. Then, we discard half, merge (almost) identical ones and run another ten iterations. This is repeated until a single one is left.

Figure 4 shows that this hybrid approach is an improvement: now, it is almost never beaten by $\delta $ switching. Of course, the hybrid approach is a bit slower again. The starting value procedure for $\delta $ switching could be improved in the same way.

## 7. Conclusions

We introduced the triangular representation of the I(2) model and showed how it can be used for estimation. The trilinear form of the triangular representation has the advantage that estimation can be implemented as alternating least squares, without using reduced-rank regression. This structure allows us to impose restrictions on (parts of) the A and B matrices, which gives more flexibility than is available in the $\delta $ and $\tau $ representations.

We also presented an algorithm based on the $\delta $-representation and compared the performance to triangular switching in an application based on Danish data, as well as a parametric bootstrap using that data. Combined with the acceleration of Doornik (2017), both algorithms are fast and give mostly the same result. This will improve empirical applications of the I(2) model and facilitate recursive estimation and Monte Carlo analysis. Expressions for the computation of t-values of coefficients will be reported in a separate paper.

Because they are considerably faster than the previous generation, bootstrapping the I(2) model can now be considered, as Cavaliere et al. (2012) did for the I(1) model.

## Acknowledgments

I am grateful to Peter Boswijk, Søren Johansen and Katarina Juselius for providing detailed comments as this paper was developing. Their suggestions have greatly improved the results presented here. Financial support from the Robertson Foundation (Award 9907422) and the Institute for New Economic Thinking (Grant 20029822) is gratefully acknowledged. All computations and graphs use OxMetrics and Ox, Doornik (2013).

## Conflicts of Interest

The author declares no conflict of interest.

## Appendix A. Estimation Using the QR Decomposition

The data matrices in the I(2) model (8) are ${Z}_{i}^{\prime}=({z}_{i1}:...:{z}_{iT})$ for $i=0,1,2$.

Take the QR decomposition of $({Z}_{2}:{Z}_{1})$ as $({Z}_{2}:{Z}_{1})P=QR={Q}_{z}({R}_{2}:{R}_{1})$ where Q is a $T\times T$ orthogonal matrix and R a $T\times 2{p}_{1}$ upper triangular matrix, while ${Q}_{z}$ are the $T\times 2{p}_{1}$ leading columns of Q and $({R}_{2}:{R}_{1})$ a $2{p}_{1}\times 2{p}_{1}$ upper triangular matrix. P is the orthogonal matrix that captures the column reordering. Then:
where $({X}_{2}:{X}_{1})$ is no longer triangular. Introduce:
where ${X}_{0}={Q}_{z}{Z}_{0}$ is $2{p}_{1}\times 2{p}_{1}$, then:

$${Q}_{z}^{\prime}({Z}_{2}:{Z}_{1})=({R}_{2}:{R}_{1}){P}^{\prime}=({X}_{2}:{X}_{1}),$$

$$\left(\begin{array}{c}{X}_{0}\\ {X}_{0}^{*}\end{array}\right)={Q}^{\prime}{Z}_{0},$$

$${Z}_{i}^{\prime}{Z}_{j}={Z}_{i}^{\prime}Q{Q}^{\prime}{Z}_{j}=\left\{\begin{array}{cc}{X}_{0}^{\prime}{X}_{0}+{X}_{0}^{*\prime}{X}_{0}^{*}\hfill & \mathrm{if}\phantom{\rule{4.pt}{0ex}}i=j=0,\hfill \\ {X}_{i}^{\prime}{X}_{j}\hfill & \mathrm{otherwise}.\hfill \end{array}\right.$$

Now, e.g., a regression of ${A}^{\prime}{z}_{0t}$ on ${B}^{\prime}{z}_{1t}$ for known $A,B$:
has:
This is a regression of ${X}_{0}A$ on ${X}_{1}B$. If such regressions need to be done often for the same Z’s, it is more efficient to do them in terms of the ${X}_{i}$:
with estimated residual variance:
This regression has fewer ‘observations’, while at the same time avoiding the creation of moment matrices. Precomputed moment matrices would be faster, but not as good numerically. For recursive estimation, it is useful to be able to handle singular regressions because dummy variables can be zero over a subsample; this happens naturally in the QR approach. This approach needs to be adjusted when (A1) also has ${z}_{0t}$ on the right-hand side, as happens for $\tau $-switching in (A3).

$${A}^{\prime}{z}_{0t}=\gamma {B}^{\prime}{z}_{1t}+{\u03f5}_{t},\phantom{\rule{1.em}{0ex}}t=1,...,T,$$

$$\widehat{\gamma}={\left({B}^{\prime}{Z}_{1}^{\prime}{Z}_{1}B\right)}^{-1}{B}^{\prime}{Z}_{1}^{\prime}{Z}_{0}A={\left({B}^{\prime}{X}_{1}^{\prime}{X}_{1}B\right)}^{-1}{B}^{\prime}{X}_{1}^{\prime}{X}_{0}A.$$

$${A}^{\prime}{x}_{0i}=\gamma {B}^{\prime}{x}_{1i}+{e}_{i},\phantom{\rule{1.em}{0ex}}i=1,...,2{p}_{1},$$

$${\widehat{\Omega}}_{e}={T}^{-1}\left({A}^{\prime}{X}_{0}^{*\prime}{X}_{0}^{*}A+\sum _{i=1}^{2{p}_{1}}{\widehat{e}}_{i}\right).$$

#### Reduced Rank Regression

Let RRR$({Z}_{0},{Z}_{1}|{Z}_{x})$ denote reduced rank regression of ${z}_{0t}$ on ${z}_{1t}$ corrected for ${z}_{xt}$. Assume that $({Z}_{0},{Z}_{1},{Z}_{x})$ have been transformed into $({X}_{0},{X}_{1},{X}_{x})$ using the QR decomposition described above. Concentrating ${X}_{x}$ out can be done by regression of $({X}_{0},{X}_{1})$ on ${X}_{x}$, with residuals $(Y,X)$. Form ${S}_{00}={Y}^{\prime}Y+{X}_{0}^{*\prime}{X}_{0}^{*}$, and decompose using the Cholesky decomposition: ${S}_{00}=L{L}^{\prime}$.

We need to solve the matrix pencil:
Start by using the QR decomposition $X=QR{P}^{\prime}$, $y={P}^{\prime}x$:
The second line introduces $W={L}^{-1}{Y}^{\prime}Q$; the next line removes R; and the final line takes the SVD of ${W}^{\prime}$. The eigenvalues are the squared singular values that are on the diagonal of ${\Sigma}^{2}$, and the eigenvectors are $P{R}^{-1}U$.

$${X}^{\prime}Y{S}_{00}^{-1}{Y}^{\prime}Xx=\lambda {X}^{\prime}Xx.$$

$$\begin{array}{cc}\hfill {R}^{\prime}{Q}^{\prime}Y{L}^{-1\prime}{L}^{-1}{Y}^{\prime}QRy& =\lambda {R}^{\prime}Ry,\hfill \\ \hfill {R}^{\prime}{W}^{\prime}WRy& =\lambda {R}^{\prime}Ry,\hfill \\ \hfill {W}^{\prime}Wz& =\lambda z,\hfill \\ \hfill U{\Sigma}^{2}{U}^{\prime}z& =\lambda z.\hfill \end{array}$$

When X is singular, as may be the case in recursive estimation, the upper triangular matrix R will have rows and columns that are zero at the bottom and end. These are the same on the left and right of the pencil, so they can be dropped. The resulting reduced dimension R is full rank, and we can set the corresponding rows in the eigenvectors to zero. When the regressors are singular, their corresponding coefficients in $\beta $ will be set to zero, just as in our regressions.

This approach differs somewhat from Doornik and O’Brien (2002) because of the different structure of ${S}_{00}$ as a consequence of the prior QR transformation.

## Appendix B. Tau-Switching Algorithm

The algorithm of Johansen (1997, §8) is based on the $\tau $-representation and involves three stages:

- The estimate of $\tau $ is obtained by GLS given all other parameters except $\psi $. Johansen (1997, p. 451) shows the GLS expressions using second moment matrices. Define the orthogonal matrix $\mathrm{A}=({\alpha}_{\perp}:\overline{\overline{\alpha}})$, then using ${\kappa}^{\prime}{\tau}^{\prime}{z}_{1t}=\mathrm{vec}\left({z}_{1t}^{\prime}\tau \kappa \right)=({\kappa}^{\prime}\otimes {z}_{1t})\mathrm{vec}\tau $:$$\begin{array}{cc}\hfill {\mathrm{A}}^{\prime}{z}_{0t}& =\left(\begin{array}{c}{\kappa}^{\prime}\otimes {z}_{1t}\\ {\varrho}^{\prime}\otimes {z}_{2t}\end{array}\right)\mathrm{vec}\tau +\left(\begin{array}{c}0\\ {I}_{r}\otimes {z}_{1t}\end{array}\right)\mathrm{vec}\psi +\left(\begin{array}{c}{\epsilon}_{1t}\\ {\epsilon}_{2t}\end{array}\right)\hfill \\ & =\left\{\left(\begin{array}{c}{\kappa}^{\prime}\\ 0\end{array}\right)\otimes {z}_{1t}+\left(\begin{array}{c}0\\ {\varrho}^{\prime}\end{array}\right)\otimes {z}_{2t}\right\}\mathrm{vec}\tau +\left\{\left(\begin{array}{c}0\\ {I}_{r}\end{array}\right)\otimes {z}_{1t}\right\}\mathrm{vec}\psi +{u}_{t}.\hfill \end{array}$$
- Given just $\tau $, reduced-rank regression of ${z}_{0t}$ corrected for ${\tau}^{\prime}{z}_{1t}$ on ${z}_{0t}$ corrected for ${z}_{1t},{\tau}^{\prime}{z}_{2t}$ is used to estimate $\alpha $. Details are in Johansen (1997, p. 450).
- Given $\tau $ and $\alpha $, the remaining parameters can be obtained by GLS. The equivalence ${\overline{\overline{\alpha}}}^{\prime}={\overline{\alpha}}^{\prime}-{\overline{\alpha}}^{\prime}w{\alpha}_{\perp}^{\prime}$ is used to write the conditional equation as:$${\overline{\alpha}}^{\prime}{z}_{0t}={\gamma}^{\prime}{\alpha}_{\perp}^{\prime}{z}_{0t}+{\varrho}^{\prime}{\tau}^{\prime}{z}_{2t}+{\psi}^{\prime}{z}_{1t}+{\epsilon}_{2t},$$$${\alpha}_{\perp}^{\prime}{z}_{0t}={\kappa}^{\prime}{\tau}^{\prime}{z}_{1t}+{\epsilon}_{1t}.$$

$\tau $-switching algorithm:

To start, set $k=1$, and choose starting values ${\alpha}^{\left(0\right)},{\beta}^{\left(0\right)}$, tolerance ${\epsilon}_{1}$ and the maximum number of iterations. Compute ${\tau}_{c}^{\left(0\right)}$ from (18) and ${\kappa}^{\left(0\right)},{\psi}^{\left(0\right)},{\Omega}^{\left(0\right)}$ from (A3) and (A4). Furthermore, compute ${f}^{\left(0\right)}=-log\left|{\Omega}^{\left(0\right)}\right|$.

- 1.
- Get ${\tau}_{c}^{\left(k\right)}$ from (A2). Identify this as follows. Select the non-singular $(r+s)\times (r+s)$ submatrix from $\tau $ with the largest volume, say M. We find M by using the first $r+s$ column pivots that are chosen by the QR decomposition of $\tau $ (Golub and Van Loan (2013, Algorithm 5.4.1) ). Set ${\tau}_{c}^{\left(k\right)}\leftarrow {\tau}_{c}^{\left(k\right)}M$. Get ${\alpha}_{c}^{\left(k\right)}$ by RRR; finally, get the remaining parameters from (A3) and (A4).
- 2...
- As steps 2,3,T from the $\delta $-switching algorithm. ☐

The line search is only for the ${p}_{1}{s}_{2}^{*}$ parameters in $\tau $ as part of it is set to a unit matrix every time. The function evaluation inside the line search needs to obtain all of the other parameters as $\tau $ changes.

This is the algorithm of Johansen (1997) except for the normalization of $\tau $ and the line search. The former protects the parameter values from exploding, while the latter improves convergence speed and makes it more robust. Removing $\varrho $ is largely for convenience: it has little impact on convergence. The $\tau $-switching algorithm is easily adjusted for common restrictions on $\tau $ in the form of $\tau =H\tilde{\tau}$. However, $\varrho $ gets in the way of more general restrictions.

## Appendix C. Starting Values

The first starting value procedure is:

- Set ${\alpha}^{(-1)},{\beta}^{(-1)}$ to their I(1) values (i.e., with full rank $\Gamma $).
- Take two iterations with the relevant switching algorithm subject to restrictions.

The second starting value procedure is:

- Get ${\alpha}^{(-2)},{\beta}^{(-2)}$ by RRR from the $\tau $-representation using $\kappa =0$:$${z}_{0t}=\alpha ({\beta}^{\prime}{z}_{2t}+{\psi}^{\prime}{z}_{1t})+{\u03f5}_{t}.$$
- Get ${\alpha}^{(-1)},{\beta}^{(-1)}$ by RRR from the $\tau $-representation:$${z}_{0t}-w{\kappa}^{\prime}{\beta}^{\prime}{z}_{1t}=\alpha ({\beta}^{\prime}{z}_{2t}+{\psi}^{\prime}{z}_{1t})+{\u03f5}_{t}.$$
- Take two iterations with the relevant switching algorithm subject to restrictions.

## References

- Anderson, Theodore W. 1951. Estimating linear restrictions on regression coefficients for multivariate normal distributions. Annals of Mathematical Statistics 22: 327–51, (Erratum in Annals of Statistics 8, 1980). [Google Scholar] [CrossRef]
- Anderson, Theodore W. 2002. Reduced rank regression in cointegrated models. Journal of Econometrics 106: 203–16. [Google Scholar] [CrossRef]
- Boswijk, H. Peter. 2010. Mixed Normal Inference on Multicointegration. Econometric Theory 26: 1565–76. [Google Scholar] [CrossRef]
- Boswijk, H. Peter, and Jurgen A. Doornik. 2004. Identifying, Estimating and Testing Restricted Cointegrated Systems: An Overview. Statistica Neerlandica 58: 440–65. [Google Scholar] [CrossRef]
- Cavaliere, Giuseppe, Anders Rahbek, and R.A.M. Taylor. 2012. Bootstrap Determination of the Co-Integration Rank in Vector Autoregressive Models. Econometrica 80: 1721–40. [Google Scholar]
- Dennis, Jonathan G., and Katarina Juselius. 2004. CATS in RATS: Cointegration Analysis of Time Series Version 2. Technical Report; Evanston: Estima. [Google Scholar]
- Doornik, Jurgen A. 2013. Object-Oriented Matrix Programming using Ox, 7th ed. London: Timberlake Consultants Press. [Google Scholar]
- Doornik, Jurgen A. 2017. Accelerated Estimation of Switching Algorithms: The Cointegrated VAR Model and Other Applications. Oxford: Department of Economics, University of Oxford. [Google Scholar]
- Doornik, Jurgen A., and R. J. O’Brien. 2002. Numerically Stable Cointegration Analysis. Computational Statistics & Data Analysis 41: 185–93. [Google Scholar] [CrossRef]
- Golub, Gen H., and Charles F. Van Loan. 2013. Matrix Computations, 4th ed. Baltimore: The Johns Hopkins University Press. [Google Scholar]
- Johansen, Søren. 1988. Statistical Analysis of Cointegration Vectors. Journal of Economic Dynamics and Control 12: 231–54, Reprinted in R. F. Engle, and C. W. J. Granger, eds. 1991. Long-Run Economic Relationships. Oxford: Oxford University Press, pp. 131–52. [Google Scholar] [CrossRef]
- Johansen, Søren. 1991. Estimation and Hypothesis Testing of Cointegration Vectors in Gaussian Vector Autoregressive Models. Econometrica 59: 1551–80. [Google Scholar] [CrossRef]
- Johansen, Søren. 1992. A Representation of Vector Autoregressive Processes Integrated of Order 2. Econometric Theory 8: 188–202. [Google Scholar] [CrossRef]
- Johansen, Søren. 1995a. Likelihood-based Inference in Cointegrated Vector Autoregressive Models. Oxford: Oxford University Press. [Google Scholar]
- Johansen, Søren. 1995b. Identifying Restrictions of Linear Equations with Applications to Simultaneous Equations and Cointegration. Journal of Econometrics 69: 111–32. [Google Scholar] [CrossRef]
- Johansen, Søren. 1995c. A Statistical Analysis of Cointegration for I(2) Variables. Econometric Theory 11: 25–59. [Google Scholar] [CrossRef]
- Johansen, Søren. 1997. Likelihood Analysis of the I(2) Model. Scandinavian Journal of Statistics 24: 433–62. [Google Scholar] [CrossRef]
- Johansen, Søren, and Katarina Juselius. 1990. Maximum Likelihood Estimation and Inference on Cointegration—With Application to the Demand for Money. Oxford Bulletin of Economics and Statistics 52: 169–210. [Google Scholar] [CrossRef]
- Johansen, Søren, and Katarina Juselius. 1992. Testing Structural Hypotheses in a Multivariate Cointegration Analysis of the PPP and the UIP for UK. Journal of Econometrics 53: 211–44. [Google Scholar] [CrossRef]
- Johansen, Søren, and Katarina Juselius. 1994. Identification of the Long-run and the Short-run Structure. An Application to the ISLM Model. Journal of Econometrics 63: 7–36. [Google Scholar] [CrossRef]
- Juselius, Katarina. 2006. The Cointegrated VAR Model: Methodology and Applications. Oxford: Oxford University Press. [Google Scholar]
- Paruolo, Paolo. 2000a. Asymptotic Efficiency of the Two Stage Estimator in I(2) Systems. Econometric Theory 16: 524–50. [Google Scholar] [CrossRef]
- Paruolo, Paolo. 2000b. On likelihood-maximizing algorithms for I(2) VAR models. Mimeo. Varese: Universitá dell’Insubria. [Google Scholar]
- Paruolo, Paolo, and Anders Rahbek. 1999. Weak exogeneity in I(2) VAR Systems. Journal of Econometrics 93: 281–308. [Google Scholar] [CrossRef]

**Figure 1.**Comparison of algorithms: $\delta $-switching (top row) and triangular-switching (bottom row). Simulating a range of $r,s$. Number of iterations on the horizontal axis, count (out of 1000) on the vertical.

**Figure 2.**Comparison of algorithms: $\delta $-switching (left two) and triangular-switching (right two). Simulating a range of $r,s$. Number of iterations on the horizontal axis, count (out of 1000) on the vertical.

**Figure 3.**$\delta $-switching function value minus the triangular switching function value (vertical axis) for each replication (horizontal axis). Both starting from their default starting values. The labels are the cointegration indices $(r,s,{s}_{2})$.

**Figure 4.**$\delta $-switching function value minus the hybrid triangular-switching function value (vertical axis) for each replication (horizontal axis).

**Table 1.**Definitions of the symbols used in the $\tau $ and $\delta $ representations of the I(2) model.

Definition | Dimension | ||
---|---|---|---|

$\tau $ | = | $(\beta :{\beta}_{\perp}\eta )\phantom{\rule{4.pt}{0ex}}\mathrm{when}\phantom{\rule{4.pt}{0ex}}{\varrho}^{\prime}=(I:0)$ | ${p}_{1}\times (r+s)$ |

${\tau}_{\perp}$ | = | ${\beta}_{\perp}{\eta}_{\perp}$ | ${p}_{1}\times {s}_{2}^{*}$ |

$\psi $ | = | $-{({\overline{\overline{\alpha}}}^{\prime}\Gamma )}^{\prime}$ | ${p}_{1}\times r$ |

${\kappa}^{\prime}$ | = | $-{\alpha}_{\perp}^{\prime}\Gamma \overline{\tau}=-({\alpha}_{\perp}^{\prime}\Gamma \overline{\beta}:\xi )={({\kappa}_{1}:{\kappa}_{2})}^{\prime}$ | $(p-r)\times (r+s)$ |

$\delta $ | = | $-{\overline{\alpha}}^{\prime}\Gamma {\tau}_{\perp}$ | $r\times {s}_{2}^{*}$ |

$\zeta $ | = | $-\Gamma \overline{\tau}=({\zeta}_{1}:{\zeta}_{2})$ | $p\times (r+s)$ |

w | = | ${\alpha}_{\perp}-\alpha {\overline{\overline{\alpha}}}^{\prime}{\alpha}_{\perp}=\Omega {\alpha}_{\perp}{\left({\alpha}_{\perp}^{\prime}\Omega {\alpha}_{\perp}\right)}^{-1}=\overline{\overline{{\alpha}_{\perp}}}$ | $p\times (p-r)$ |

d | = | ${\tau}_{\perp}{\delta}^{\prime}$ | ${p}_{1}\times r$ |

e | = | $\tau {\zeta}^{\prime}$ | ${p}_{1}\times p$ |

**Table 2.**Links between symbols used in the representations of the I(2) model, assuming ${W}_{11}={I}_{r}$ and ${a}_{\perp}^{\prime}{a}_{\perp}=I$.

$-\Gamma =\alpha {\psi}^{\prime}+w{\kappa}^{\prime}{\tau}^{\prime}=\alpha \delta {\tau}_{\perp}^{\prime}+\zeta {\tau}^{\prime}=\alpha {d}^{\prime}+{e}^{\prime}$ | |||

$\zeta $ | = | $\alpha {\psi}^{\prime}\overline{\tau}+w{\kappa}^{\prime}$ | $(\phantom{\rule{4.pt}{0ex}}\mathrm{from}\phantom{\rule{4.pt}{0ex}}\Gamma \overline{\tau})$ |

${d}^{\prime}$ | = | ${\psi}^{\prime}{\tau}_{\perp}{\tau}_{\perp}^{\prime}$ | $(\phantom{\rule{4.pt}{0ex}}\mathrm{from}\phantom{\rule{4.pt}{0ex}}\Gamma {\tau}_{\perp})$ |

${\kappa}^{\prime}$ | = | ${\alpha}_{\perp}^{\prime}\zeta $ | $(\phantom{\rule{4.pt}{0ex}}\mathrm{from}\phantom{\rule{4.pt}{0ex}}{\alpha}_{\perp}^{\prime}\Gamma )$ |

${\psi}^{\prime}$ | = | ${d}^{\prime}+{\overline{\overline{\alpha}}}^{\prime}\zeta {\tau}^{\prime}$ | $(\phantom{\rule{4.pt}{0ex}}\mathrm{from}\phantom{\rule{4.pt}{0ex}}{\overline{\overline{\alpha}}}^{\prime}\Gamma )$ |

$\alpha $ | = | ${A}_{0}$ | |

$\beta $ | = | ${B}_{0}$ | |

${d}^{\prime}$ | = | $-{V}_{13}{B}_{2}^{\prime}$ | |

${e}^{\prime}$ | = | $-A({V}_{.1}:{V}_{.2}){({B}_{0}:{B}_{1})}^{\prime}$ | |

$\tau $ | = | $({B}_{0}:{B}_{1})$ |

**Table 3.**Estimation of all I(2) models by $\tau ,\delta $ and triangular switching; all using the same starting value procedure. Number of iterations to convergence for ${\epsilon}_{1}={10}^{-14}$.

r$\backslash {\mathit{s}}_{2}$ | $\mathit{\tau}$ Switching | $\mathit{\delta}$ Switching | Triangular Switching | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|

4 | 3 | 2 | 1 | 4 | 3 | 2 | 1 | 4 | 3 | 2 | 1 | |

1 | 19 | 25 | 36 | 34 | 15 | 24 | 37 | 30 | 31 | 31 | 39 | 32 |

2 | 18 | 32 | 25 | 18 | 32 | 34 | 22 | 27 | 50 | |||

3 | 37 | 23 | 42 | 38 | 50 | 59 | ||||||

4 | 29 | 28 | 85 |

**Table 4.**Estimation of all I(2) models by old versions of $\tau ,\delta $ switching. Number of iterations to convergence for ${\epsilon}_{1}={10}^{-14}$.

r$\setminus {\mathit{s}}_{2}$ | Old $\mathit{\tau}$ Switching | CATS2 Switching | ||||||
---|---|---|---|---|---|---|---|---|

4 | 3 | 2 | 1 | 4 | 3 | 2 | 1 | |

1 | 126 | 198 | 338 | 201 | 5229 | 8329 | 8516 | 5371 |

2 | 79 | 211 | 229 | 7234 | 709 | 861 | ||

3 | 483 | 237 | 550 | 432 | ||||

4 | 4851 | 5771 |

© 2017 by the author. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (http://creativecommons.org/licenses/by/4.0/).