View source: R/bruceR-stats_5_advance.R
granger_causality | R Documentation |
Granger test of predictive causality (between multivariate time series)
based on vector autoregression (VAR
) model.
Its output resembles the output of the vargranger
command in Stata (but here using an F test).
granger_causality( varmodel, var.y = NULL, var.x = NULL, test = c("F", "Chisq"), file = NULL, check.dropped = FALSE )
varmodel |
VAR model fitted using the |
var.y, var.x |
[Optional] Default is |
test |
F test and/or Wald χ^2 test. Default is both: |
file |
File name of MS Word ( |
check.dropped |
Check dropped variables. Default is |
Granger causality test (based on VAR model) examines whether the lagged values of a predictor (or predictors) help to predict an outcome when controlling for the lagged values of the outcome itself.
Granger causality does not necessarily constitute a true causal effect.
A data frame of results.
ccf_plot
,
granger_test
## Not run: # R package "vars" should be installed library(vars) data(Canada) VARselect(Canada) vm = VAR(Canada, p=3) model_summary(vm) granger_causality(vm) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.