This function takes two signals collected at the same irregularly spaced intervals and performs a Granger-Causal test for the required alternative hypothesis (i.e. one signal Granger-causes the other or both signals Granger-cause each other). See Heerah et al., 2020 for more details on the procedure.

granger_test(
  root,
  shoot,
  times,
  theta = NULL,
  alternative = "twodir",
  H = 100,
  seed = 123,
  showprogress = TRUE
)

Arguments

root

A double value of the vector containing the detrended and standardized measurements of the first signal (the root expressions).

shoot

A double value of the vector containing the detrended and standardized measurements of the second signal (the shoot expressions).

times

A double value of the vector collecting the times (measured in the same unit) at which the measurements were taken for both signals (root and shoot).

theta

A double value of the vector providing the starting values for the full model parameter vector (for this reason the length of the vector must be exactly 8). If not provided (default is theta = NULL), then starting values will be found using an approximation based on the assumption of regularly spaced measurements.

alternative

A character value defining the alternative hypothesis for the Granger-Causal test (with the null hypothesis always being "the signals do not Granger-cause each other"). The default value is "twodir" which tests the alternative that "both signals Granger-cause each other". The other options are "rtos" which tests the alternative "the first signal (root) Granger-causes the second signal (shoot)" and "stor" which tests the alternative "the second signal (shoot) Granger-causes the first signal (root)".

H

A positive integer representing the number of parametric bootstrap replicates used to estimate the distribution of the test statistic under the null hypothesis.

seed

A positive integer defining the seed value for the simulated signals throughout the parametric bootstrap procedure (default is seed = 123).

showprogress

A boolean determining whether a progress-bar should be shown to update the user on the progress of the bootstrap procedure (defaults to TRUE).

Value

A list with the following objects:

alternative

The code of the alternative hypothesis that is tested.

stat

The test statistic used to perform the Granger-Causal test.

pvalue

The p-value computed using the bootstrap distribution under the null hypothesis.

parameters

The parameters of "intensity" and "time of impact" for the alternative hypothesis that is tested.

Details

The procedure is based on the work in Heerah et al., 2020 where the null hypothesis states that "neither of the signals Granger-causes the other". According to the alternative hypothesis specified by the user, the function computes the corresponding p-value using a parametric bootstrap procedure. If the null hypothesis is rejected in favour of the alternative, then the user can obtain information on (i) how strong the impact of a signal on the other is and (ii) its direction (positive or negative) also referred to as "intensity" (represented by \(\psi\)) as well as the time point at which this impact is maximal also referred to as "impact time" (represented by \(\gamma\)).

Author

Roberto Molinari and Stephane Guerrier

Examples

if (FALSE) { data(signals) times <- c(0, 5, 10, 15, 20, 30, 45, 60, 90, 120) granger_test(root = signals$root, shoot = signals$shoot, times = times, alternative = "twodir") }