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 |
data |
Data frame. |
lags |
Time lags. Defaults to |
test.reverse |
Whether to test reverse causality. Defaults to |
file |
File name of MS Word ( |
... |
Further arguments passed to |
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
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 2024.6 Index]