View source: R/bruceR-stats_5_advance.R
granger_test | R Documentation |
Granger test of predictive causality (between two time series)
using the lmtest::grangertest()
function.
granger_test(formula, data, lags = 1:5, test.reverse = TRUE, file = NULL, ...)
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 |
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.
A data frame of results.
ccf_plot
,
granger_causality
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
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.