granger_test: Granger causality test (bivariate).

Description Usage Arguments Details Value See Also Examples

View source: R/bruceR_stats_05_advance.R

Description

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

Usage

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

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.

Value

No return value.

See Also

ccf_plot, granger_causality

Examples

1
2
granger_test(chicken ~ egg, data=lmtest::ChickEgg)
granger_test(chicken ~ egg, data=lmtest::ChickEgg, lags=1:10, test.reverse=TRUE)

bruceR documentation built on June 22, 2021, 1:06 a.m.