granger_test {bruceR}R Documentation

Granger causality test (bivariate).

Description

Granger test of predictive causality (between two time series) using the lmtest::grangertest() function.

Usage

granger_test(formula, data, lags = 1:5, test.reverse = TRUE, file = NULL)

Arguments

formula

Model formula like y ~ x.

data

Data frame.

lags

Time lags. Default is 1:5.

test.reverse

Whether to test reverse causality. Default is TRUE.

file

File name of MS Word (.doc).

Details

Granger causality test examines whether the lagged values of a predictor have an incremental role in predicting (i.e., help to predict) an outcome when controlling for the lagged values of the outcome.

Granger causality does not necessarily constitute a true causal effect.

Value

A data frame of results.

See Also

ccf_plot, granger_causality

Examples

granger_test(chicken ~ egg, data=lmtest::ChickEgg)
granger_test(chicken ~ egg, data=lmtest::ChickEgg, lags=1:10, file="Granger.doc")
unlink("Granger.doc")  # delete file for code check


[Package bruceR version 0.8.0 Index]