EXAMPLE#1 Simple Simulation & Granger causality

library(VLTimeCausality)
## Loading required package: dtw
## Loading required package: proxy
## 
## Attaching package: 'proxy'
## The following objects are masked from 'package:stats':
## 
##     as.dist, dist
## The following object is masked from 'package:base':
## 
##     as.matrix
## Loaded dtw v1.21-3. See ?dtw for help, citation("dtw") for use in publication.
## Loading required package: tseries
## Registered S3 method overwritten by 'quantmod':
##   method            from
##   as.zoo.data.frame zoo
## Loading required package: RTransferEntropy
# Generate simulation data
TS <- VLTimeCausality::SimpleSimulationVLtimeseries()
# Run the function
out<-VLTimeCausality::GrangerFunc(Y=TS$Y,X=TS$X,alpha=0.05)
#result
print(sprintf("F-TEST p-value = %f",out$p.val))
## [1] "F-TEST p-value = 0.000000"
print(sprintf("X causes Y? %d",out$XgCsY_ftest))
## [1] "X causes Y? 1"

EXAMPLE#2 Simple Simulation & VL-Granger causality

library(VLTimeCausality)
# Generate simulation data
TS <- VLTimeCausality::SimpleSimulationVLtimeseries()
# Run the function
out<-VLTimeCausality::VLGrangerFunc(Y=TS$Y,X=TS$X,gamma=0.5)
#result
print(sprintf("BICDiffRatio = %f",out$BICDiffRatio))
## [1] "BICDiffRatio = 0.803389"
print(sprintf("X causes Y? %d",out$XgCsY))
## [1] "X causes Y? 1"

EXAMPLE#3 Simple Simulation & Transfer Entropy

library(VLTimeCausality)
# Generate simulation data
TS <- VLTimeCausality::SimpleSimulationVLtimeseries()
# Run the function
out<-VLTimeCausality::VLTransferEntropy(Y=TS$Y,X=TS$X,VLflag=FALSE)
#result
print(sprintf("TEratio = %f",out$TEratio))
## [1] "TEratio = 1.476073"
print(sprintf("X causes Y? %d",out$XgCsY_trns) )
## [1] "X causes Y? 1"

EXAMPLE#4 Simple Simulation & VL-Transfer Entropy

library(VLTimeCausality)
# Generate simulation data
TS <- VLTimeCausality::SimpleSimulationVLtimeseries()
# Run the function
out<-VLTimeCausality::VLTransferEntropy(Y=TS$Y,X=TS$X,VLflag=TRUE)
#result
print(sprintf("TEratio = %f",out$TEratio))
## [1] "TEratio = 3.961960"
print(sprintf("X causes Y? %d",out$XgCsY_trns) )
## [1] "X causes Y? 1"