partGranger: Partial Granger causality

Description Usage Arguments Value Author(s) References Examples

View source: R/partGranger.R

Description

Compute partial Granger causality of multivariate timeseries.

Usage

1
partGranger(data, nx = 1, ny = 1, order=1, perm = FALSE, prob=TRUE, bs = 100)

Arguments

data

object containing all observations (rows) and variables (columns) that are being considered. The variables should be ordered as follows: First the variables that are supposed to granger cause a set of other variables (>=1). Then the set of variables (>=1) that are Granger caused by the first set of variables. Finally, a set of variables to condition on(>=1).

nx

The number of variables (>=1) that Granger cause a set of other variables (default = 1), conditioned on a third set of variables (>=1).

ny

The number of variables (>=1) that are Granger caused by the first nx variables (default = 1), conditioned on a third set of variables (>=1).

order

Autoregressive order (>=1) of timeseries. Can be computed using ARorder().

perm

Logical. If perm = FALSE (default), only the Granger causality measure is produced. If perm = TRUE, the Granger test is computed and a permutation test is performed to do inference.

prob

Logical. If TRUE, the F statistic is returned together with the p-value.

bs

Number of permutation samples. Only works when perm = TRUE. Default=100

Value

Partial Granger causality measure F1 plus p -value.

Author(s)

Bjorn Roelstraete

References

Guo, S., Seth, A.K., Kendrick, K.M., Zhou, C., Feng, J.(2008). Partial Granger Causality-Eliminating Exogenous Inputs and Latent Variables. Journal of Neuroscience Methods. 79-93.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
# Example data with 5 regions x, y, z, q, w
head(grangerdata)

# Calculate AR() order of the data
ARorder(grangerdata, max=10)
 
# Compute partial conditional granger causality of region x to regions y 
# and z, conditional on regions q and w
F <- partGranger(grangerdata, nx=1, ny=2, order=3)

# Compute F and permutation H0 distribution
F <- partGranger(grangerdata, nx=1, ny=2, order=3, perm=TRUE,bs=10)

FIAR documentation built on June 5, 2018, 5:03 p.m.

Related to partGranger in FIAR...