Learn R Programming

patterncausality (version 0.2.1)

pcAccuracy: Calculate Pattern Causality Accuracy

Description

Evaluates the causality prediction accuracy across multiple time series within a dataset using the PC Mk. II Light method. This function analyzes pairwise causality relationships and computes different types of causality measures.

Usage

pcAccuracy(
  dataset,
  E,
  tau,
  metric = "euclidean",
  h,
  weighted,
  distance_fn = NULL,
  state_space_fn = NULL,
  relative = TRUE,
  verbose = FALSE
)

Value

An object of class "pc_accuracy" containing:

  • parameters: List of input parameters (E, tau, metric, h, weighted)

  • total: Mean total causality across all pairs

  • positive: Mean positive causality across all pairs

  • negative: Mean negative causality across all pairs

  • dark: Mean dark causality across all pairs

  • matrices: Raw causality matrices for each type

Arguments

dataset

A matrix or data frame where each column represents a time series

E

Integer; embedding dimension for state space reconstruction (E > 1)

tau

Integer; time delay for state space reconstruction (tau > 0)

metric

Character; distance metric to use, one of "euclidean", "manhattan", or "maximum"

h

Integer; prediction horizon, indicating forecast distance (h >= 0)

weighted

Logical; whether to use weighted approach in calculating causality strengths

distance_fn

Optional custom distance function for computing distances (default: NULL)

state_space_fn

Optional custom function for state space reconstruction (default: NULL)

relative

Logical; if TRUE calculates relative changes ((new-old)/old), if FALSE calculates absolute changes (new-old) in signature space. Default is TRUE.

verbose

Logical; whether to display progress information (default: FALSE)

Details

Calculate Pattern Causality Accuracy

See Also

pcMatrix for analyzing individual causality matrices pcLightweight for pairwise causality analysis

Examples

Run this code
# \donttest{
data(climate_indices)
data <- climate_indices[, -1]
results <- pcAccuracy(dataset = data, E = 3, tau = 1, 
                     metric = "euclidean", h = 1, 
                     weighted = TRUE, verbose = TRUE)
print(results)
# }

Run the code above in your browser using DataLab