FCVARmodel.m:
A Matlab software package for estimation and testing in
the fractionally cointegrated VAR model
∗
version 1.2
Morten Ørregaard Nielsen
†
Queen’s University and CREATES
Email: [email protected]
Lealand Morin
Queen’s University
Email: [email protected]
February 1, 2012
Abstract
This manual describes the usage of the accompanying freely available software pack-
age for estimation and testing in the fractionally cointegrated vector autoregressive
(VAR) model.
JEL Codes: C22, C32.
Keywords: cofractional process, cointegration rank, computer program, fractional au-
toregressive model, fractional cointegration, fractional unit root, Matlab, VAR model.
∗
We are grateful to Søren Johansen and James MacKinnon for comments and to the Social Sciences
and Humanities Research Council of Canada (SSHRC grant 410-2009-0183) and the Center for Research in
Econometric Analysis of Time Series (CREATES, funded by the Danish National Research Foundation) for
research support.
†
Corresponding author. If you find any bugs or other problems, please let us know.
1
Contents
1 Obtaining and using the software package 3
1.1 Disclaimer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.2 Obtaining the software package . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.3 Citation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.4 Using the software package . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.5 Version history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
2 The fractionally cointegrated VAR model 4
2.1 Maximum likelihood estimation . . . . . . . . . . . . . . . . . . . . . . . . . 4
2.2 Cointegration rank tests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2.3 Restricted models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
3 Main program: FCVARmodel.m 7
4 Output: the Danish data 8
5 Options files 13
5.1 Default estimation options: DefaultEstnOptions.m . . . . . . . . . . . . . 13
5.2 Restricted estimation options: RestrictEstnOptions.m . . . . . . . . . . . 15
6 Other main files 17
6.1 Rank tests: RankTests.m . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
6.2 Model estimation: FCVARestn.m . . . . . . . . . . . . . . . . . . . . . . . . . 18
6.3 Obtain residuals: GetResiduals.m . . . . . . . . . . . . . . . . . . . . . . . 19
7 Auxilliary files 20
7.1 AdjustEstnOptions.m . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
7.2 CharPolyRoots.m . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
7.3 FCVARhess.m . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
7.4 FCVARlike.m . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
7.5 FracDiff.m . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
7.6 FreeParams.m . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
7.7 FullFCVARlike.m . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
7.8 GetParams.m . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
7.9 GetParamsSwitching.m . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
7.10 Lbk.m . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
7.11 SEmat2vec.m . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
7.12 SEvec2mat.m . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
7.13 TransformData.m . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
8 List of references 34
2
1 Obtaining and using the software package
1.1 Disclaimer
We have done our best to make this program as functional and free from errors as possible,
but no warranty is given whatsoever. We cannot guarantee that we have been 100% successful
in eliminating bugs, so if you find any please let us know.
1.2 Obtaining the software package
The software package can be downloaded from the first author’s website at Queen’s Univer-
sity:
http://www.econ.queensu.ca/faculty/mon/software/
It is freely available for non-commercial, academic use.
1.3 Citation
If you use this software, or any program or computer codes based on this software, we ask
that you please cite this document. For example, you could add “The results were obtained
using the computer software by Nielsen and Morin (2012)” in the main text of your paper
and then add the citation
Nielsen, M. Ø. and L. Morin (2012). “FCVARmodel.m: A Matlab software package for esti-
mation and testing in the fractionally cointegrated VAR model, v1.2.” QED working paper
1273, Queen’s University.
to your list of references.
1.4 Using the software package
The use of this software package requires a functioning installation of Matlab. Any recent
version should work. Unzip the contents of the zip file into any directory, maintaining the
directory structure in the zip file, will place all the main files into that directory and create
a subdirectory with the auxiliary files.
The next section describes the fractionally cointegrated VAR model and the restricted
models that can be estimated with this software package. Section 3 describes the functioning
of the main program, and section 4 shows an example of the output. Section 5 describes
the options file and the various settings. With these programs, both the unrestricted and
restricted models can be estimated. It is then straightforward to calculate likelihood ratio test
statistics and perform the tests. The cointegration rank tests can be calculated automatically
using the program in section 6.1 and the model parameters can be estimated using the
program in section 6.2. Section 6.3 describes how to obtain residuals for model diagnostics
and section 7 describes auxiliary files.
1.5 Version history
v1.2 (February 1, 2012): Updated the manual related to the restricted constant term.
v1.1 (September 30, 2011): Changed the sign on ρ.
v1.0 (August 26, 2011): First publicly available version.
3
2 The fractionally cointegrated VAR model
The fractionally cointegrated vector autoregressive (FC-VAR) model was proposed in Jo-
hansen (2008) and analyzed by Johansen and Nielsen (2010, 2012), henceforth JN. For a
time series X
t
of dimension p, the fractionally cointegrated VAR model is given in error
correction form as
∆
d
X
t
= ∆
d−b
L
b
αβ
0
X
t
+
k
X
i=1
Γ
i
∆
d
L
i
b
X
t
+ ε
t
, t = 1, . . . , T, (1)
where ε
t
is p-dimensional i.i.d.(0, Ω), d ≥ b > 0, ∆
d
is the fractional difference operator, and
L
b
= 1 − ∆
b
is the fractional lag operator.
1
For the model with d = b it is also possible to
include a constant term to obtain
∆
d
X
t
= L
d
α(β
0
X
t
+ ρ
0
) +
k
X
i=1
Γ
i
∆
d
L
i
d
X
t
+ ε
t
, t = 1, . . . , T, (2)
The models (1) and (2) include the Johansen (1996) cointegrated VAR model as the
special case d = b = 1, and the interpretation of the model parameters is similar. Thus, the
observed data X
t
are integrated of order d, and b is the strength of the cointegrating relations
in the sense that higher b implies less persistence in the cointegrating relations. Writing
Π = αβ
0
, where the p × r matrices α and β with r ≤ p are assumed to have full column rank
r, the columns of β are the r cointegrating (cofractional) relations that determine the long-
run equilibria, and α holds the coefficients that determine speed of adjustment towards the
equilibria. The parameters Γ = (Γ
1
, . . . , Γ
k
) govern the short-run dynamics. The parameter
ρ is the so-called restricted constant term (since the constant term in the model is restricted
to be of the form µ = αρ
0
), which is interpreted as giving the mean level of the long-run
equilibria, i.e. Eβ
0
X
t
+ ρ
0
= 0. The rank r is termed the cointegrating, or cofractional, rank.
This model thus has the same main structure as in the standard C-VAR in that it allows
for modeling of both cointegration and adjustment towards equilibrium, but is more general
since it accommodates fractional integration and cointegration.
In the next three subsections we briefly describe estimation and testing within the model
(1). For details we refer to JN (2012).
2.1 Maximum likelihood estimation
The model (1) is estimated by conditional maximum likelihood (given initial values) by
maximizing the function
log L
T
(λ) = −
T
2
log det(T
−1
T
X
t=1
ε
t
(λ)ε
t
(λ)
0
), (3)
where
ε
t
(λ) = ∆
d
X
t
− ∆
d−b
L
b
αβ
0
X
t
−
k
X
i=1
Γ
i
∆
d
L
i
b
X
t
, λ = (d, b, α, β, Γ), (4)
1
Both are defined in terms of their binomial expansion in the lag operator L. Note that the expansion of
L
b
has no term in L
0
and thus only lagged disequilibrium errors appear in (1).
4
for model (1) and
ε
t
(λ) = ∆
d
X
t
− L
d
α(β
0
X
t
+ ρ
0
) −
k
X
i=1
Γ
i
∆
d
L
i
d
X
t
, λ = (d, α, β, ρ, Γ), (5)
for model (2). It is shown in JN (2012) how, for fixed (d, b) the estimation reduces to
regression and reduced rank regression as in Johansen (1996). In this way the parameters
(α, β, ρ, Γ) can be concentrated out of the likelihood function, and numerical optimization is
only needed to optimize the profile likelihood function over the two fractional parameters, d
and b.
JN (2012) shows that asymptotic theory is standard when b < 0.5, and for the case
b > 0.5 asymptotic theory is non-standard and involves fractional Brownian motion of type
II. Specifically, when b > 0.5, JN (2012) shows that under i.i.d. errors with suitable moment
conditions, the conditional maximum likelihood parameter estimates (
ˆ
d,
ˆ
b, ˆα,
ˆ
Γ
1
, . . . ,
ˆ
Γ
k
) are
asymptotically Gaussian, while (
ˆ
β, ˆρ) are locally asymptotically mixed normal. These re-
sults allow asymptotically standard (chi-squared) inference on all parameters of the model,
including the cointegrating relations and orders of fractionality, using quasi-likelihood ratio
tests.
2.2 Cointegration rank tests
The likelihood ratio (LR) test statistic of the hypothesis H
r
: rank(Π) = r against H
p
:
rank(Π) = p is of particular interest because it deals with an important empirical question.
Let L(d, b, r) be the profile likelihood function given rank r, where (α, β, Γ) have been con-
centrated out by regression and reduced rank regression; see JN (2012) for details. In the
case of model (2) the test is H
r
: rank(Π, µ) = r against H
p
: rank(Π, µ) = p and L(d, r)
denotes the profile likelihood function for rank r, where (α, β, ρ, Γ) have been concentrated
out.
The profile likelihood function is maximized both under the hypothesis H
r
and under H
p
and the LR test statistic is then LR
T
(q) = 2log(L(
ˆ
d
p
,
ˆ
b
p
, p)/L(
ˆ
d
r
,
ˆ
b
r
, r)), where q = p − r,
L(
ˆ
d
p
,
ˆ
b
p
, p) = max
d,b
L(d, b, p), L(
ˆ
d
r
,
ˆ
b
r
, r) = max
d,b
L(d, b, r),
and with obvious modification for model (2). This problem is qualitatively different from
that in Johansen (1996) since the asymptotic distribution of LR
T
(q) depends qualitatively
(and quantitatively) on the parameter b. In the case with 0 < b < 1/2 (sometimes known as
“weak cointegration”), LR
T
(q) has a standard asymptotic distribution, namely LR
T
(q)
D
→
χ
2
(q
2
). On the other hand, when 1/2 < b ≤ d (“strong cointegration”), asymptotic theory
is nonstandard and
LR
T
(q)
D
→ Tr
(
Z
1
0
dW (s)F
0
(s)
Z
1
0
F (s)F
0
(s)ds
−1
Z
1
0
F (s)dW
0
(s)
)
, (6)
where the vector process dW is the increment of ordinary vector Brownian motion of dimen-
sion q = p−r. The vector process F depends on the deterministics similar to the cointegrated
VAR model in Johansen (1996). When no deterministic term is in the model, F (u) = W
b
(u),
5