ms_condgrangertest {movementsync}R Documentation

Test for Conditional Granger Causality

Description

Faster implementation of the vector version of lmtest::grangertest() with conditioning on the history of a third variable. The function assumes time series always have the same start date and periodicity, which is true for the data in this package.

Usage

ms_condgrangertest(x, y, z, order = 1, na.action = stats::na.omit, ...)

Arguments

x

response vector of observations.

y

explanatory vector of observations.

z

conditioning vector of observations

order

number of lags (in frames).

na.action

a function for eliminating NAs after aligning the series x and y.

...

passed to lmtest::waldtest().

Value

Anova object

See Also

Other Granger Causality: autoplot.GrangerTime(), get_granger_interactions(), granger_test(), map_to_granger_test(), ms_grangertest1(), ms_grangertest2(), plot.GrangerInteraction(), plot_influence_diagram()

Examples

data(wages, package = "lmtest")
diff_wages <- diff(wages)

# Granger tests
lmtest::grangertest(diff_wages[, 'w'], diff_wages[, 'CPI'], order = 3)
ms_grangertest1(diff_wages[, 'w'], diff_wages[, 'CPI'], order = 3)
ms_grangertest2(diff_wages[, 'w'], diff_wages[, 'CPI'], order = 3)

ms_condgrangertest(diff_wages[, 'w'], diff_wages[, 'CPI'], diff_wages[, 'u'], order = 3)

[Package movementsync version 0.1.4 Index]