Learn R Programming

bruceR (version 0.7.2)

granger_test: 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 = FALSE)

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 FALSE.

Value

No return value.

Details

The Granger causality test examines whether the lagged values of a predictor have any incremental role in predicting an outcome if controlling for the lagged values of the outcome itself.

See Also

ccf_plot, granger_causality

Examples

Run this code
# NOT RUN {
granger_test(chicken ~ egg, data=lmtest::ChickEgg)
granger_test(chicken ~ egg, data=lmtest::ChickEgg, lags=1:10, test.reverse=TRUE)

# }

Run the code above in your browser using DataLab