GrangerFunc {VLTimeCausality} | R Documentation |
GrangerFunc
Description
GrangerFunc is a Granger Causality function. It tests whether X
Granger-causes Y
.
Usage
GrangerFunc(
Y,
X,
maxLag = 1,
alpha = 0.05,
autoLagflag = TRUE,
gamma = 0.5,
family = gaussian
)
Arguments
Y |
is a numerical time series of effect |
X |
is a numerical time series of cause |
maxLag |
is a maximum possible time delay. The default is 1. |
alpha |
is a significance level of F-test to determine whether |
autoLagflag |
is a flag for enabling the automatic lag inference function. The default is true. If it is set to be true, then maxLag is set automatically using cross-correlation. Otherwise, if it is set to be false, then the function takes the maxLag value to infer Granger causality. |
gamma |
is a parameter to determine whether |
family |
is a parameter of family of function for Generalized Linear Models function (glm). The default is |
Value
This function returns of whether X
Granger-causes Y
.
ftest |
F-statistic of Granger causality. |
p.val |
A p-value from F-test. |
BIC_H0 |
Bayesian Information Criterion (BIC) derived from |
BIC_H1 |
Bayesian Information Criterion (BIC) derived from |
XgCsY |
The flag is true if |
XgCsY_ftest |
The flag is true if |
XgCsY_BIC |
The flag is true if |
maxLag |
A maximum possible time delay. |
H0 |
glm object of |
H1 |
glm object of |
BICDiffRatio |
Bayesian Information Criterion difference ratio: |
Examples
# Generate simulation data
TS <- SimpleSimulationVLtimeseries()
# Run the function
out<-GrangerFunc(Y=TS$Y,X=TS$X)