Title: | Inference on Granger-Causality in the Frequency Domain |
Version: | 0.1.0 |
Author: | Matteo Farne' <matteo.farne2@unibo.it>, Angela Montanari <angela.montanari@unibo.it> |
Maintainer: | Matteo Farne' <matteo.farne2@unibo.it> |
Description: | Contains five functions performing the calculation of unconditional and conditional Granger-causality spectra, bootstrap inference on both, and inference on the difference between them via the bootstrap approach of Farne' and Montanari, 2018 <doi:10.48550/arXiv.1803.00374>. |
Depends: | R (≥ 3.5) |
License: | GPL-2 | GPL-3 [expanded from: GPL (≥ 2)] |
URL: | https://github.com/MatFar88/grangers |
Imports: | vars, tseries |
Encoding: | UTF-8 |
LazyData: | true |
RoxygenNote: | 6.1.1 |
NeedsCompilation: | no |
Packaged: | 2019-05-30 23:14:59 UTC; Calif |
Repository: | CRAN |
Date/Publication: | 2019-06-03 12:50:13 UTC |
Conditional Granger-causality estimation
Description
Conditional Granger-causality spectrum was first defined in Geweke (1984). It
measures the strength of the causal link from time series y
to time series x
once
removed the mediating effect of z
in the frequency domain. Differently from function
Granger.unconditional
, this function provides only the unidirectional
causality from y
to x
. Here we need to estimate two VAR models: the first on x
and z
, the
second on x
, y
, z
, by package vars. Parameters specified for function VAR hold for
both estimations. For computational details we refer to Ding et al. (2006).
Usage
Granger.conditional(x, y, z, ic.chosen = "SC", max.lag = min(4,
length(x) - 1), plot = F, type.chosen = "none", p1 = 0, p2 = 0)
Arguments
x |
univariate time series. |
y |
univariate time series (of the same length of |
z |
univariate time series (of the same length of |
ic.chosen |
estimation method parameter |
max.lag |
maximum number of lags |
plot |
logical; if TRUE, it returns the plot of conditional Granger-causality spectrum. Defaults to FALSE. |
type.chosen |
parameter |
p1 |
parameter |
p2 |
parameter |
Details
Granger.conditional
calculates the Granger-causality conditional spectrum of a
time series x
(effect variable) on a time series z
(conditioning variable) respect
to a time series y
(cause variable). It requireNamespaces package vars.
Value
frequency
: frequencies used by Fast Fourier Transform.
n
: time series length.
Conditional_causality_y.to.x.on.z
: computed conditional Granger-causality from y
to x
on z
.
roots_1
: the roots of the estimated VAR on x
and y
.
roots_2
: the roots of the estimated VAR on x
, y
and z
.
The result is returned invisibly if plot is TRUE.
Author(s)
Matteo Farne', matteo.farne2@unibo.it
References
Geweke J., 1984. Measures of conditional linear dependence and feedback between time series. J. Am. Stat. Assoc. 79, 907–915.
Ding, M., Chen, Y., Bressler, S.L., 2006. Granger Causality: Basic Theory and Application to Neuroscience, Chap.17. Handbook of Time Series Analysis Recent Theoretical Developments and Applications.
Farne', M., Montanari, A., 2018. A bootstrap test to detect prominent Granger-causalities across frequencies. <arXiv:1803.00374>, Submitted.
See Also
VAR
.
Examples
RealGdp.rate.ts<-euro_area_indicators[,1]
m3.rate.ts<-euro_area_indicators[,2]
hicp.rate.ts<-euro_area_indicators[,4]
cond_m3.to.gdp.by.hicp<-
Granger.conditional(RealGdp.rate.ts,m3.rate.ts,hicp.rate.ts,"SC",4)
Inference on conditional Granger-causality
Description
Inference on the conditional Granger-causality spectrum is provided generating bootstrap time series by the stationary boostrap of Politis and Romano (1994). For computational details we refer to Ding et al. (2006) and Farne' and Montanari (2018).
Usage
Granger.inference.conditional(x, y, z, ic.chosen = "SC",
max.lag = min(4, length(x) - 1), plot = F, type.chosen = "none",
p1 = 0, p2 = 0, nboots = 1000, conf = 0.95, bp = NULL,
ts_boot = 1)
Arguments
x |
univariate time series. |
y |
univariate time series (of the same length of |
z |
univariate time series (of the same length of |
ic.chosen |
estimation method parameter |
max.lag |
maximum number of lags |
plot |
logical; if TRUE, it returns the plot of unconditional Granger-causality spectra on both directions with computed thresholds. Defaults to FALSE. |
type.chosen |
parameter |
p1 |
parameter |
p2 |
parameter |
nboots |
number of bootstrap series to be computed by function |
conf |
prescribed confidence level. It defaults to 0.95. |
bp |
matrix containing previously simulated bootstrap series, having as rows time points, as columns variables |
ts_boot |
boolean equal to 1 if the stationary bootstrap of Politis and Romano (1994) is applied, 0 otherwise. It defaults to 1. |
Details
Granger.inference.conditional
provides bootstrap inference for the Granger-causality
conditional spectrum of a time series x
(effect variable) on a time series z
(conditioning variable)
respect to a time series y
(cause variable). It requires packages vars
and tseries.
Value
frequency
: frequencies used by Fast Fourier Transform.
n
: time series length.
nboots
: number of bootstrap series used.
confidence_level
: prescribed confidence level.
stat_yes
: boolean equal to 0 if no stationary VAR
is estimated across bootstrap samples, 1 otherwise.
non_stationarity_rate_1
: percentage of non-stationary VAR models (at
least one root larger than one) estimated on bootstrapped x
and z
.
non_stationarity_rate_2
: percentage of non-stationary VAR models (at
least one root larger than one) estimated on bootstrapped x
and y
and z
.
delay1_mean
: mean number of delays of stationary VAR models estimated on x
and z
.
delay2_mean
: mean number of delays of stationary VAR models estimated on x
and y
and z
.
quantile_conditional_causality_y.to.x.on.z
: computed quantile of the Granger-
causality conditional spectrum from y
to x
on z
. Differently from function
Granger.inference.unconditional
, this function provides only the quantile
of the unidirectional causality from y
to x
.
freq_y.to.x.on.z
: frequencies at which the Granger-causality conditional spectrum
from y
to x
condtional on z
exceeds the computed threshold.
q_max_x.on.z
: computed quantile of the Granger-
causality conditional spectrum from y
to x
on z
under Bonferroni correction. Differently from function
Granger.inference.unconditional
, this function provides only the quantile
of the unidirectional causality from y
to x
.
freq_max_y.to.x.on.z
: frequencies at which the Granger-causality conditional spectrum
from y
to x
conditional on z
exceeds the computed threshold under Bonferroni correction.
The result is returned invisibly if plot is TRUE.
Author(s)
Matteo Farne', Angela Montanari, matteo.farne2@unibo.it
References
Politis D. N. and Romano J. P., (1994). ”The Stationary Bootstrap”. Journal of the American Statistical Association, 89, 1303–1313.
Ding, M., Chen, Y., Bressler, S.L., 2006. Granger Causality: Basic Theory and Application to Neuroscience, Chap.17. Handbook of Time Series Analysis Recent Theoretical Developments and Applications.
Farne', M., Montanari, A., 2018. A bootstrap test to detect prominent Granger-causalities across frequencies. <arXiv:1803.00374>, Submitted.
See Also
VAR and tsbootstrap
.
Examples
RealGdp.rate.ts<-euro_area_indicators[,1]
m3.rate.ts<-euro_area_indicators[,2]
hicp.rate.ts<-euro_area_indicators[,4]
inf_cond_m3.to.gdp.by.hicp_0.95<-
Granger.inference.conditional(RealGdp.rate.ts,m3.rate.ts,hicp.rate.ts,nboots=10)
Inference on the difference between unconditional and conditional Granger-causality
Description
Inference on the difference between unconditional and conditional Granger-causality spectrum is provided generating bootstrap time series by the stationary boostrap of Politis and Romano (1994). For computational details we refer to Ding et al. (2006) and Farne' and Montanari (2018).
Usage
Granger.inference.difference(x, y, z, ic.chosen = "SC",
max.lag = min(4, length(x) - 1), plot = F, type.chosen = "none",
p = 0, p1 = 0, p2 = 0, nboots = 1000, conf = 0.95,
bp_orig = NULL, ts_boot = 1)
Arguments
x |
univariate time series. |
y |
univariate time series (of the same length of |
z |
univariate time series (of the same length of |
ic.chosen |
estimation method parameter |
max.lag |
maximum number of lags |
plot |
logical; if TRUE, it returns the plot of the difference between the unconditional
Granger-causality spectrum from |
type.chosen |
parameter |
p |
parameter |
p1 |
parameter |
p2 |
parameter |
nboots |
number of bootstrap series to be computed by function |
conf |
prescribed confidence level. It defaults to 0.95. |
bp_orig |
matrix containing previously simulated bootstrap series, having as rows
time points, as columns variables |
ts_boot |
boolean equal to 1 if the stationary bootstrap of Politis and Romano (1994) is applied, 0 otherwise. It defaults to 1. |
Details
Granger.inference.difference
provides bootstrap inference for the difference between
the Granger-causality unconditional spectrum of a time series x
(effect variable)
respect to a time series y
(cause variable) and the Granger-causality conditional
spectrum of a time series x
(effect variable) on a time series z
(conditioning variable)
respect to a time series y
(cause variable). It requires packages vars and tseries.
Value
frequency
: frequencies used by Fast Fourier Transform.
n
: time series length.
nboots
: number of bootstrap series used.
confidence_level
: prescribed confidence level.
stat_yes
: boolean equal to 0 if no stationary VAR
is estimated across bootstrap samples, 1 otherwise.
non_stationarity_rate
: percentage of estimated non-stationary VAR models (at
least one root larger than one) on bootstrapped x
and y.
non_stationarity_rate_1
: percentage of estimated non-stationary VAR models (at
least one root larger than one) on bootstrapped x
and z.
non_stationarity_rate_2
: percentage of estimated non-stationary VAR models (at
least one root larger than one) on bootstrapped x
, y
and z.
quantile_difference_inf
: lower computed quantile of the difference between the
Granger-causality unconditional spectrum from y
to x
and the Granger-causality
conditional spectrum from y
to x
on z
.
quantile_difference_sup
: upper computed quantile of the difference between the
Granger-causality unconditional spectrum from y
to x
and the Granger-causality
conditional spectrum from y
to x
on z
.
freq_inf
: frequencies at which the difference between the Granger-causality unconditional spectrum
from y
to x
and the Granger-causality conditional spectrum
from y
to x
on z
exceeds the lower computed threshold.
freq_sup
: frequencies at which the difference between the Granger-causality unconditional spectrum
from y
to x
and the Granger-causality conditional spectrum
from y
to x
on z
exceeds the upper computed threshold.
quantile_difference_max_inf
: lower computed quantile of the difference between the
Granger-causality unconditional spectrum from y
to x
and the Granger-causality
conditional spectrum from y
to x
on z
under Bonferroni correction.
quantile_difference_max_sup
: upper computed quantile of the difference between the
Granger-causality unconditional spectrum from y
to x
and the Granger-causality
conditional spectrum from y
to x
on z
under Bonferroni correction.
freq_max_inf
: frequencies at which the difference between the Granger-causality unconditional
spectrum from y
to x
and the Granger-causality conditional spectrum
from y
to x
on z
exceeds the lower computed threshold under Bonferroni correction.
freq_max_sup
: frequencies at which the difference between the Granger-causality unconditional
spectrum from y
to x
and the Granger-causality conditional spectrum
from y
to x
on z
exceeds the upper computed threshold under Bonferroni correction.
The result is returned invisibly if plot is TRUE.
Author(s)
Matteo Farne', Angela Montanari, matteo.farne2@unibo.it
References
Politis D. N. and Romano J. P., (1994). ”The Stationary Bootstrap”. Journal of the American Statistical Association, 89, 1303–1313.
Ding, M., Chen, Y., Bressler, S.L., 2006. Granger Causality: Basic Theory and Application to Neuroscience, Chap.17. Handbook of Time Series Analysis Recent Theoretical Developments and Applications.
Farne', M., Montanari, A., 2018. A bootstrap test to detect prominent Granger-causalities across frequencies. <arXiv:1803.00374>, Submitted.
See Also
VAR and tsbootstrap
.
Examples
RealGdp.rate.ts<-euro_area_indicators[,1]
m3.rate.ts<-euro_area_indicators[,2]
hicp.rate.ts<-euro_area_indicators[,4]
inf_diff_pre_hicp.to.gdp_0.95<-
Granger.inference.difference(RealGdp.rate.ts,m3.rate.ts,hicp.rate.ts,nboots=10)
Inference on unconditional Granger-causality
Description
Inference on the unconditional Granger-causality spectrum is provided generating bootstrap time series by the stationary boostrap of Politis and Romano (1994). For computational details we refer to Ding et al. (2006) and Farne' and Montanari (2018).
Usage
Granger.inference.unconditional(x, y, ic.chosen = "SC",
max.lag = min(4, length(x) - 1), plot = F, type.chosen = "none",
p = 0, nboots = 1000, conf = 0.95, bp = NULL, ts_boot = 1)
Arguments
x |
univariate time series. |
y |
univariate time series (of the same length of |
ic.chosen |
estimation method parameter |
max.lag |
maximum number of lags |
plot |
logical; if TRUE, it returns the plot of unconditional Granger-causality spectra on both directions with computed thresholds. Defaults to FALSE. |
type.chosen |
parameter |
p |
parameter |
nboots |
number of bootstrap series to be computed by function |
conf |
prescribed confidence level. It defaults to 0.95. |
bp |
matrix containing previously simulated bootstrap series, having as rows
time points, as columns variables |
ts_boot |
boolean equal to 1 if the stationary bootstrap of Politis and Romano (1994) is applied, 0 otherwise. It defaults to 1. |
Details
Granger.inference.unconditional
provides bootstrap inference for the Granger-causality
unconditional spectrum of a time series x
(effect variable) respect to a time series
y
(cause variable). It requires packages vars and tseries.
Value
frequency
: frequencies used by Fast Fourier Transform.
n
: time series length.
nboots
: number of bootstrap series used.
confidence_level
: prescribed confidence level.
stat_yes
: boolean equal to 0 if no stationary VAR
is estimated across bootstrap samples, 1 otherwise.
non_stationarity_rate
: percentage of non-stationary VAR models (at
least one root larger than one) estimated on bootstrapped x
and y
.
delay_mean
: mean number of delays of stationary VAR models estimated on x
and y
.
quantile_unconditional_causality_y.to.x
: computed quantile of the Granger-causality
unconditional spectrum from y
to x
.
quantile_unconditional_causality_x.to.y
: computed quantile of the Granger-causality
unconditional spectrum from x
to y
.
freq_y.to.x
: frequencies at which the Granger-causality unconditional spectrum
from y
to x
exceeds the computed threshold.
freq_x.to.y
: frequencies at which the Granger-causality unconditional spectrum
from x
to y
exceeds the computed threshold.
q_max_x
: computed quantile of the Granger-causality
unconditional spectrum from y
to x
under Bonferroni correction.
q_max_y
: computed quantile of the Granger-causality
unconditional spectrum from x
to y
under Bonferroni correction.
freq_max_y.to.x
: frequencies at which the Granger-causality unconditional spectrum
from y
to x
exceeds the computed threshold under Bonferroni correction.
freq_max_x.to.y
: frequencies at which the Granger-causality unconditional spectrum
from x
to y
exceeds the computed threshold under Bonferroni correction.
The result is returned invisibly if plot is TRUE.
Author(s)
Matteo Farne', Angela Montanari, matteo.farne2@unibo.it
References
Politis D. N. and Romano J. P., (1994). ”The Stationary Bootstrap”. Journal of the American Statistical Association, 89, 1303–1313.
Ding, M., Chen, Y., Bressler, S.L., 2006. Granger Causality: Basic Theory and Application to Neuroscience, Chap.17. Handbook of Time Series Analysis Recent Theoretical Developments and Applications.
Farne', M., Montanari, A., 2018. A bootstrap test to detect prominent Granger-causalities across frequencies. <arXiv:1803.00374>, Submitted.
See Also
VAR and tsbootstrap
.
Examples
RealGdp.rate.ts<-euro_area_indicators[,1]
m3.rate.ts<-euro_area_indicators[,2]
inf_uncond_m3_0.95<-Granger.inference.unconditional(RealGdp.rate.ts,m3.rate.ts,nboots=10)
Unconditional Granger-causality estimation
Description
Unconditional Granger-causality spectrum was first defined in Geweke (1982).
It measures the strength of the causal link from time series y
to time series x
and
viceversa in the frequency domain. It needs to estimate a VAR model on x
and y
by package vars. For computational details we refer to Ding et al. (2006).
Usage
Granger.unconditional(x, y, ic.chosen = "SC", max.lag = min(4,
length(x) - 1), plot = F, type.chosen = "none", p = 0)
Arguments
x |
univariate time series. |
y |
univariate time series (of the same length of |
ic.chosen |
estimation method parameter |
max.lag |
maximum number of lags |
plot |
logical; if TRUE, it returns the plot of unconditional Granger-causality spectra on both directions. Defaults to FALSE. |
type.chosen |
parameter |
p |
parameter |
Details
Granger.unconditional
calculates the Granger-causality unconditional spectrum of
a time series x
(effect variable) respect to a time series y
(cause variable).
It requireNamespaces package vars.
Value
frequency
: frequencies used by Fast Fourier Transform.
n
: time series length.
Unconditional_causality_y.to.x
: computed unconditional Granger-causality from y
to x
.
Unconditional_causality_x.to.y
: computed unconditional Granger-causality from x
to y
.
roots
: the roots of the estimated VAR on x
and y
.
The result is returned invisibly if plot is TRUE.
Author(s)
Matteo Farne', Angela Montanari, matteo.farne2@unibo.it
References
Geweke, J., 1982. Measurement of linear dependence and feedback between multiple time series. J. Am. Stat. Assoc. 77, 304–313.
Ding, M., Chen, Y., Bressler, S.L., 2006. Granger Causality: Basic Theory and Application to Neuroscience, Chap.17. Handbook of Time Series Analysis Recent Theoretical Developments and Applications.
Farne', M., Montanari, A., 2018. A bootstrap test to detect prominent Granger-causalities across frequencies. <arXiv:1803.00374>, Submitted.
See Also
VAR.
Examples
RealGdp.rate.ts<-euro_area_indicators[,1]
m3.rate.ts<-euro_area_indicators[,2]
uncond_m3<-Granger.unconditional(RealGdp.rate.ts,m3.rate.ts,"SC",4)
Conditional Granger-causality test of Breitung and Candelon (2006)
Description
Inference on the conditional Granger-causality spectrum is provided by the parametric test of Breitung and Candelon (2006).
Usage
bc_test_cond(x, y, z, ic.chosen = "SC", max.lag = min(4, length(x) -
1), plot = F, type.chosen = "none", p = 0, conf = 0.95)
Arguments
x |
univariate time series. |
y |
univariate time series (of the same length of |
z |
univariate time series (of the same length of |
ic.chosen |
estimation method parameter |
max.lag |
maximum number of lags |
plot |
logical; if TRUE, it returns the plot of conditional Granger-causality spectrum. Defaults to FALSE. |
type.chosen |
parameter |
p |
parameter |
conf |
prescribed confidence level. It defaults to 0.95. |
Details
bc_test_cond
calculates the test of Breitung and Candelon (2006) on the conditional Granger-causality
of a time series x
(effect variable) on a time series z
(conditioning variable) respect to a time series y
(cause variable).
It requires package vars.
Value
frequency
: frequencies used by Fast Fourier Transform.
n
: time series length.
confidence_level
: prescribed confidence level.
significant_frequencies
: frequencies at which the test is significant..
F-test
: computed F-test at each frequency.
F-threshold
: F-threshold at each frequency under prescribed confidence level.
roots
: roots of the estimated VAR model.
delays
: delays of the estimated VAR model.
The result is returned invisibly if plot is TRUE.
Author(s)
Matteo Farne', Angela Montanari, matteo.farne2@unibo.it
References
Breitung, J., Candelon, B., 2006. Testing for short- and long-run causality: A frequency-domain approach. Journal of Econometrics. 132, 2, 363–378.
Farne', M., Montanari, A., 2018. A bootstrap test to detect prominent Granger-causalities across frequencies. <arXiv:1803.00374>, Submitted.
See Also
VAR
.
Examples
RealGdp.rate.ts<-euro_area_indicators[,1]
m3.rate.ts<-euro_area_indicators[,2]
hicp.rate.ts<-euro_area_indicators[,4]
cond_bc<-bc_test_cond(RealGdp.rate.ts,m3.rate.ts,hicp.rate.ts,ic.chosen="SC",max.lag=2)
Unconditional Granger-causality test of Breitung and Candelon (2006)
Description
Inference on the unconditional Granger-causality spectrum is provided by the parametric test of Breitung and Candelon (2006).
Usage
bc_test_uncond(x, y, ic.chosen = "SC", max.lag = min(4, length(x) - 1),
plot = F, type.chosen = "none", p = 0, conf = 0.95)
Arguments
x |
univariate time series. |
y |
univariate time series (of the same length of |
ic.chosen |
estimation method parameter |
max.lag |
maximum number of lags |
plot |
logical; if TRUE, it returns the plot of conditional Granger-causality spectrum. Defaults to FALSE. |
type.chosen |
parameter |
p |
parameter |
conf |
prescribed confidence level. It defaults to 0.95. |
Details
bc_test_uncond
calculates the test of Breitung and Candelon (2006) on the unconditional Granger-causality
of a time series x
(effect variable) respect to a time series y
(cause variable).
It requireNamespaces package vars.
Value
frequency
: frequencies used by Fast Fourier Transform.
n
: time series length.
confidence_level
: prescribed confidence level.
significant_frequencies
: frequencies at which the test is significant..
F-test
: computed F-test at each frequency.
F-threshold
: F-threshold at each frequency under prescribed confidence level.
roots
: roots of the estimated VAR model.
delays
: delays of the estimated VAR model.
The result is returned invisibly if plot is TRUE.
Author(s)
Matteo Farne', Angela Montanari, matteo.farne2@unibo.it
References
Breitung, J., Candelon, B., 2006. Testing for short- and long-run causality: A frequency-domain approach. Journal of Econometrics. 132, 2, 363–378.
Farne', M., Montanari, A., 2018. A bootstrap test to detect prominent Granger-causalities across frequencies. <arXiv:1803.00374>, Submitted.
See Also
VAR
.
Examples
RealGdp.rate.ts<-euro_area_indicators[,1]
m3.rate.ts<-euro_area_indicators[,2]
uncond_bc<-bc_test_uncond(RealGdp.rate.ts,m3.rate.ts,ic.chosen="SC",max.lag=2)
Six Euro Area Monetary Indicators
Description
This data set gives thre quarterly time series of real gross domestic product, M3 aggregate, M1 aggregate, inflation rate (HICP), unemployment rate and long-term interest rate for the Euro Area from Q1,1999 to Q4,2017, according to the ECB Real Time DataBase (RTDB).
Usage
euro_area_indicators
Format
A matrix containing as columns six quarterly time series ranging from Q1,1999 to Q4,2017.
Details
Documentation of the dataset 'euro_area_indicators'
Source
ECB Real Time DataBase 'https://sdw.ecb.europa.eu/browse.do?node=9689716'.
References
Farne', M., Montanari, A., 2018. A bootstrap test to detect prominent Granger-causalities across frequencies. <arXiv:1803.00374>, Submitted.
Euro Area Real Time Database documentation. 'http://sdw.ecb.europa.eu/web/docu/rtdb_docu.pdf'