granger_test: Granger Non-Causality Test

View source: R/granger.R

granger_testR Documentation

Granger Non-Causality Test

Description

Tests for Granger non-causality in the RBFM-VAR framework using a modified Wald statistic. The test is asymptotically chi-squared under the null hypothesis, regardless of the integration order of the variables.

Usage

granger_test(object, cause, effect)

Arguments

object

An rbfmvar object from rbfmvar.

cause

Character string. Name of the causing variable.

effect

Character string. Name of the affected variable.

Details

The Granger non-causality hypothesis is:

H_0: x \text{ does not Granger-cause } y

This is tested by examining whether the coefficients on lagged values of cause in the equation for effect are jointly zero.

Under the FM+ framework of Chang (2000), the Wald statistic has an asymptotic chi-squared distribution that provides a conservative (valid) p-value even when variables have unknown integration orders.

Value

A list of class "rbfmvar_granger" containing:

cause

Name of the causing variable.

effect

Name of the affected variable.

statistic

Modified Wald statistic.

df

Degrees of freedom.

p.value

P-value (conservative).

coefficients

Restricted coefficients being tested.

References

Chang, Y. (2000). Vector Autoregressions with Unknown Mixtures of I(0), I(1), and I(2) Components. Econometric Theory, 16(6), 905-926. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1017/S0266466600166071")}

Toda, H. Y., & Yamamoto, T. (1995). Statistical Inference in Vector Autoregressions with Possibly Integrated Processes. Journal of Econometrics, 66(1-2), 225-250. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1016/0304-4076(94)01616-8")}

Examples

# Simulate VAR data
set.seed(42)
n <- 200
e <- matrix(rnorm(n * 3), n, 3)
y <- matrix(0, n, 3)
colnames(y) <- c("x", "y", "z")
for (t in 3:n) {
  y[t, "x"] <- 0.5 * y[t-1, "x"] + e[t, 1]
  y[t, "y"] <- 0.3 * y[t-1, "y"] + 0.4 * y[t-1, "x"] + e[t, 2]
  y[t, "z"] <- 0.2 * y[t-1, "z"] + e[t, 3]
}

fit <- rbfmvar(y, lags = 2)

# Test if x Granger-causes y (should be significant)
test1 <- granger_test(fit, cause = "x", effect = "y")
print(test1)

# Test if z Granger-causes y (should not be significant)
test2 <- granger_test(fit, cause = "z", effect = "y")
print(test2)


rbfmvar documentation built on April 9, 2026, 9:08 a.m.