causality | R Documentation |
Computes the test statistics for Granger- and Instantaneous causality for a VAR(p).
causality(x, cause = NULL, vcov.=NULL, boot=FALSE, boot.runs=100)
x |
Object of class ‘ |
cause |
A character vector of the cause variable(s). If not set,
then the variable in the first column of |
vcov. |
a specification of the covariance matrix of the estimated coefficients. This can be
specified as a matrix or as a function yielding a matrix when applied to |
boot |
Logical. Whether a wild bootstrap procedure should be used to compute the critical values. Default is no |
boot.runs |
Number of bootstrap replications if boot=TRUE |
Two causality tests are implemented. The first is a F-type
Granger-causality test and the second is a Wald-type test that is
characterized by testing for nonzero correlation between the error
processes of the cause and effect variables. For both tests the vector
of endogenous variables \bold{y}_t
is split into two subvectors
\bold{y}_{1t}
and \bold{y}_{2t}
with dimensions (K_1
\times 1)
and (K_2 \times 1)
with K = K_1 + K_2
.
For the rewritten VAR(p):
[\bold{y}_{1t} , \bold{y}_{2t}] = \sum_{i=1}^p [\bold{\alpha}_{11, i}' ,
\bold{\alpha}_{12, i}' | \bold{\alpha}_{21, i}' , \bold{\alpha}_{22,
i}'][\bold{y}_{1,t-i}, \bold{y}_{2, t-i}] + CD_t + [\bold{u}_{1t},
\bold{u}_{2t}] \quad ,
the null hypothesis that the subvector \bold{y}_{1t}
does not
Granger-cause \bold{y}_{2t}
, is defined as
\bold{\alpha}_{21, i} = 0
for i = 1, 2, \ldots, p
. The
alternative is: \exists \; \bold{\alpha}_{21,i} \ne 0
for i =
1, 2, \ldots, p
. The test statistic is distributed as F(p K_1
K_2, KT - n^*)
, with n^*
equal to the total number of
parameters in the above VAR(p) (including deterministic
regressors).
The null hypothesis for instantaneous causality is defined as:
H_0: C \bold{\sigma} = 0
, where C
is a (N \times K(K
+ 1)/2)
matrix of rank N
selecting the relevant co-variances of
\bold{u}_{1t}
and \bold{u}_{2t}
; \bold{\sigma} =
vech(\Sigma_u)
. The Wald statistic is defined as:
\lambda_W = T \tilde{\bold{\sigma}}'C'[2 C D_{K}^{+}(\tilde{\Sigma}_u
\otimes \tilde{\Sigma}_u) D_{K}^{+'} C']^{-1} C
\tilde{\bold{\sigma}} \quad ,
hereby assigning the Moore-Penrose inverse of the duplication matrix
D_K
with D_{K}^{+}
and \tilde{\Sigma}_u =
\frac{1}{T}\sum_{t=1}^T \hat{\bold{u}}_t \hat{\bold{u}}_t'
. The
duplication matrix D_K
has dimension (K^2 \times
\frac{1}{2}K(K + 1))
and is defined such that for any symmetric
(K \times K)
matrix A, vec(A) = D_K vech(A)
holds. The
test statistic \lambda_W
is asymptotically distributed as
\chi^2(N)
.
Fot the Granger causality test, a robust covariance-matrix estimator can be
used in case of heteroskedasticity through argument vcov.
It can be either a pre-computed matrix or
a function for extracting the covariance matrix. See vcovHC
from package sandwich for further details.
A wild bootstrap computation (imposing the restricted model as null)
of the p values is available through argument boot
and boot.runs
following Hafner and Herwartz (2009).
A list with elements of class ‘htest
’:
Granger |
The result of the Granger-causality test. |
Instant |
The result of the instantaneous causality test. |
The Moore-Penrose inverse matrix is computed with the function
ginv
contained in the package ‘MASS
’.
The Granger-causality test is problematic if some of the
variables are nonstationary. In that case the usual asymptotic
distribution of the test statistic may not be valid under the null
hypothesis.
Bernhard Pfaff
Granger, C. W. J. (1969), Investigating causal relations by econometric models and cross-spectral methods, Econometrica, 37: 424-438.
Hafner, C. M. and Herwartz, H. (2009) Testing for linear vector autoregressive dynamics under multivariate generalized autoregressive heteroskedasticity, Statistica Neerlandica, 63: 294-323
Hamilton, J. (1994), Time Series Analysis, Princeton University Press, Princeton.
Lütkepohl, H. (2006), New Introduction to Multiple Time Series Analysis, Springer, New York.
Venables, W. N. and B. D. Ripley (2002), Modern Applied Statistics with S, 4th edition, Springer, New York.
Zeileis, A. (2006) Object-Oriented Computation of Sandwich Estimators Journal of Statistical Software, 16, 1-16
VAR
data(Canada)
var.2c <- VAR(Canada, p = 2, type = "const")
causality(var.2c, cause = "e")
#use a robust HC variance-covariance matrix for the Granger test:
causality(var.2c, cause = "e", vcov.=vcovHC(var.2c))
#use a wild-bootstrap procedure to for the Granger test
## Not run: causality(var.2c, cause = "e", boot=TRUE, boot.runs=1000)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.