Skip to content

The pcCrossValidation function performs cross-validation on time series data to evaluate the robustness of pattern causality measures. It repeatedly samples subsets of the data, applies the pattern causality algorithm, and aggregates the results to provide a comprehensive assessment of the causality metrics.

Usage

pcCrossValidation(X, Y, E, tau, metric, h, weighted, numberset)

Arguments

X

A numeric vector representing the first time series.

Y

A numeric vector representing the second time series.

E

An integer specifying the embedding dimension for the state space reconstruction.

tau

An integer specifying the time delay for the state space reconstruction.

metric

A character string specifying the distance metric used in the causality computation (e.g., "euclidean").

h

An integer specifying the prediction horizon.

weighted

A logical value indicating whether to apply weighted causality measures.

numberset

A numeric vector specifying the sample sizes for the cross-validation procedure.

Value

A data frame containing the aggregated causality metrics across different sample sizes. The data frame includes the positive, negative, and dark causality percentages.

Examples

# \donttest{
data(DJS)
X <- DJS$X3M
Y <- DJS$American.Express
numberset <- c(1000,2000,3000,4000)
result <- pcCrossValidation(X,Y,3,2,"euclidean",1,FALSE,numberset)
#> 
  |                                                                      
  |                                                                |   0%
  |                                                                      
  |#####################                                           |  33%
  |                                                                      
  |###########################################                     |  67%
  |                                                                      
  |################################################################| 100%
print(result)
#>       positive  negative      dark
#> 1000 0.3611111 0.2777778 0.3611111
#> 2000 0.3142329 0.2975970 0.3881701
#> 3000 0.2805195 0.3168831 0.4025974
#> 4000 0.3415277 0.2317823 0.4266901
# }