View source: R/cointBootTest.R
cointBootTest | R Documentation |
This function uses the bootstrap and wild bootstrap to test the cointegration rank of a VAR model. The test is an implementation of Cavaliere, Rahbek & Taylor (2012, 2014), and is used in Ahlgren & Catani (2018).
cointBootTest(y, r = "sequence", p, model = 1, signif = 0.05, dummies = NULL, B = 999,
boot_type = c("B", "WB"), WB_dist = c("rademacher", "normal", "mammen"), verbose = TRUE)
## S3 method for class 'cointBootTest'
print(x, ...)
y |
a T x K matrix containing the time series. |
r |
either |
p |
the lag order of the model. |
model |
either 1 (no deterministic terms), 2 (restricted constant), or 3 (restricted linear trend). See 'details' below. |
signif |
if |
dummies |
(optional) dummy variables. Must have the same number of rows as |
B |
the number of bootstrap replications. |
boot_type |
either "B", "WB", or both. "B" uses the iid bootstrap algorithm, while "WB" uses the wild bootstrap algorithm. |
WB_dist |
The distribution used for the wild bootstrap. Either "rademacher", "normal", or "mammen". |
verbose |
logical; if |
x |
Object with class attribute ‘cointBootTest’. |
... |
further arguments passed to or from other methods. |
Consider the K
-dimensional heteroskedastic cointegrated VAR model of Cavaliere,
Rahbek and Taylor (2014):
\Delta\mathbf{y}_{t}=\boldsymbol{\alpha}\boldsymbol{\beta}^{\prime}\mathbf{y}_{t-1}+\sum_{i=1}^{p-1}\mathbf{\Gamma}_{i}\Delta\mathbf{y}_{t-i}+\boldsymbol{\alpha}\boldsymbol{\rho}^{\prime}D_{t}+\bm{\phi}d_{t}+\bm{\varepsilon}_{t},\ \ \ \ t=1,\ldots ,T,
where \boldsymbol{\alpha}
and \boldsymbol{\beta}
are \left( K \times r \right)
matrices of rank r<K
, the number r
being the cointegration rank. D_{t}
and d_{t}
differ according to the model
argument in the following manner:
model 1: D_{t}=0
and d_{t}=0
(no deterministic
terms)
model 2: D_{t}=1
and d_{t}=0
(restricted constant)
model 3: D_{t}=1
and d_{t}=1
(restricted linear trend)
The likelihood ratio (LR) statistic for testing cointegration rank r
against K
is
Q_{r,T}=-T\sum_{i=r+1}^{K}\text{log}( 1 - \widehat{\lambda}_{i},),
where the eigenvalues \mathbf{\widehat{\lambda}}_{1}>\ldots >\mathbf{\widehat{\lambda}}_{K}
are the K
largest solutions to a certain eigenvalue
problem (see Johansen 1996).
Bootstrap and wild bootstrap algorithm of Cavaliere, et al. (2012, 2014):
1. Estimate the model under H(r)
using Gaussian PMLE yielding the estimates \boldsymbol{\widehat{\beta}}^{(r)}
, \boldsymbol{\widehat{\alpha}}^{(r)}
,
\boldsymbol{\widehat{\rho}}^{(r)}
, \mathbf{\widehat{\Gamma}}_{1}^{(r)},\ldots,\mathbf{\widehat{\Gamma}}_{p-1}^{(r)}
and \widehat{\bm{\phi}}^{(r)}
, together with the corresponding residuals, \widehat{\bm{\varepsilon}}_{r,t}
.
2. Check that the equation | \widehat{\mathbf{A}}^{(r)}(z) |=0
, with \widehat{\mathbf{A}}^{(r)}(z):=(1-z)\mathbf{I}_{K}-\boldsymbol{\widehat{\alpha}}^{(r)}\boldsymbol{\widehat{\beta}}^{(r)\prime}z-\sum_{i=1}^{p-1}\mathbf{\widehat{\Gamma}}_{i}^{(r)}(1-z)z^{i}
, has K-r
roots equal to 1 and all other roots outside the unit circle. If so, procede to step 3.
3. Construct the bootstrap sample recursively from
\Delta\mathbf{y}_{r,t}^{\ast}=\boldsymbol{\widehat{\alpha}}^{(r)}\boldsymbol{\widehat{\beta}}^{(r)\prime}\mathbf{y}_{r,t-1}^{\ast}+\sum_{i=1}^{p-1}\mathbf{\widehat{\Gamma}}_{i}^{(r)}\Delta\mathbf{y}_{r,t-i}^{\ast}+\boldsymbol{\widehat{\alpha}}^{(r)}\boldsymbol{\widehat{\rho}}^{(r)\prime}D_{t}+\widehat{\bm{\phi}}^{(r)}d_{t}+\bm{\varepsilon}_{r,t}^{\ast},\ \ \ \ t=1,\ldots ,T,
initialized at \mathbf{y}_{r,j}^{\ast}=\mathbf{y}_{j}, j=1-p,\ldots,0
, and with the T
bootstrap errors \bm{\varepsilon}_{r,t}^{\ast}
generated using the residuals \widehat{\bm{\varepsilon}}_{r,t}
. The bootstrap errors are generated depending on the boot_type
argument in the following manner:
boot_type = "B"
: The i.i.d. bootstrap, such that \bm{\varepsilon}_{r,t}^{\ast}:=\mathbf{\widehat{\bm{\varepsilon}}}_{r,\mathcal{U}_{t}}
, where \mathcal{U}_{t}, t=1,\ldots ,T
is an i.i.d. sequence of discrete uniform distributions on \{1,2,\ldots, T\}
.
boot_type = "WB"
: The wild bootstrap, where for each t=1,\ldots ,T
, \bm{\varepsilon}_{r,t}^{\ast}:=\widehat{\bm{\varepsilon}}_{r,t}w_{t}
, where w_{t}, t=1,\ldots ,T
, is an i.i.d. sequence distributed according to the WB_dist
argument.
4. Using the bootstrap sample, \{\mathbf{y}_{r,t}^{\ast}\}
, and denoting by \mathbf{\widehat{\lambda}}_{1}^{\ast}>\ldots >\mathbf{\widehat{\lambda}}_{K}^{\ast}
the ordered solutions to the bootstrap analogue of the eigenvalue problem, compute the bootstrap LR statistic Q_{r,T}^{\ast}:=-T\sum_{i=r+1}^{K}\text{log}( 1 - \widehat{\lambda}_{i}^{\ast})
. Define the corresponding p
-value as p_{r,T}^{\ast}:=1-G_{r,T}^{\ast}(Q_{r,T})
, G_{r,T}^{\ast}
(.) denoting the conditional (on the original data) cdf of Q_{r,T}^{\ast}
.
5. The bootstrap test of H(r)
against H(K)
at level \mathbf{\eta}
rejects H(r)
if p_{r,T}^{\ast}\leq\mathbf{\eta}
.
If r = "sequence"
, the algorithm is repeated for each null hypothesis H(r), r=0,\ldots ,K-1
, and the first null hypothesis with a p_{r,T}^{\ast}>\mathbf{\eta}
is selected as the cointegration rank. If p_{r,T}^{\ast}\leq\mathbf{\eta}, r=0,\ldots ,K-1
, the rank selected is \widehat{r}=K
.
a list of class "cointBootTest"
.
eigen_val |
the eigenvalues. |
eigen_vec |
the eigenvectors. |
alpha |
a matrix with the estimated alpha parameters for the model with |
beta |
a matrix with the estimated beta parameters for the model with |
gamma |
a list of matrices with the estimated gamma parameters. Each parameter matrix corresponds to the model estimated under the null hypothesis in |
rho |
a matrix with the estimated rho parameters for the model with |
phi |
a list of matrices with the estimated phi parameters. Each parameter matrix corresponds to the model estimated under the null hypothesis in |
dummy_coefs |
a list of matrices with the estimated dummy parameters. Each parameter matrix corresponds to the model estimated under the null hypothesis in |
residuals |
a list of residual matrices, one for each model estimated under the null hypothesis in |
Q |
a vector with the Q test statistics. If |
B.Q |
a matrix of the iid bootstrap Q statistics. Each column represent the null hypothesis in the order of |
WB.Q |
a matrix of the wild bootstrap Q statistics. Each column represent the null hypothesis in the order of |
B.r |
the selected cointegration rank from the iid bootstrap test, if |
WB.r |
the selected cointegration rank from the wild bootstrap test, if |
B.pv |
a vector with the bootstrap P.values, in the order of |
WB.pv |
a vector with the wild bootstrap P.values, in the order of |
B.errors |
the number of times the bootstrap simulations had to be resimulated due to errors. |
WB.errors |
the number of times the wild bootstrap simulations had to be resimulated due to errors. |
companion_eigen |
a list of matrices with the eigenvalues of the companion matrix. The inverse of the eigenvalues are the roots in step 2 of the boostrap algorithm (see the .pdf version of this help file). |
Ahlgren, N. & Catani, P. (2018). Practical Problems with Tests of Cointegration Rank with Strong Persistence and Heavy-Tailed Errors. In Corazza, M., Durábn, M., Grané, A., Perna, C., Sibillo, M. (eds) Mathematical and Statistical Methods for Actuarial Sciences and Finance, Cham, Springer.
Cavaliere, G., Rahbek, A., & Taylor, A. M. R. (2012). Bootstrap determination of the co-integration rank in vector autoregressive models, Econometrica, 80, 1721-1740.
Cavaliere, G., Rahbek, A., & Taylor, A. M. R. (2014). Bootstrap determination of the co-integration rank in heteroskedastic VAR models, Econometric Reviews, 33, 606-650.
Johansen, S. (1996). Likelihood-based inference in cointegrated vector autoregressive models, Oxford, Oxford University Press.
test <- cointBootTest(y = VodafoneCDS, r = "sequence", p = 2, model = 3, signif = 0.05,
dummies = NULL, B = 999, boot_type = c("B", "WB"), WB_dist = "rademacher")
test
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.