Skip to content

This function performs dynamic network analysis to detect causal interactions between multiple time series within a dataset. It uses the Pattern Causality Model Mk. II to evaluate positive, negative, and dark causality relationships by analyzing the reconstructed state spaces of the time series. The function iterates through each time series in the dataset, comparing them to identify potential causal links.

Usage

pcMatrix(dataset, E, tau, metric, h, weighted)

Arguments

dataset

A data frame where each column represents a time series to be analyzed for causal relationships.

E

An integer specifying the embedding dimension for reconstructing the state space of the time series.

tau

An integer representing the time delay used in reconstructing the time series in the embedded space.

metric

A character string specifying the distance metric to be used in the analysis (e.g., 'euclidean').

h

An integer indicating the prediction horizon, i.e., the number of steps ahead for which predictions are made.

weighted

A logical value indicating whether the analysis should apply a weighted approach when calculating causality strength.

Value

A list containing three matrices (positive, negative, dark) that represent the detected causal relationships between the time series in the dataset. Each matrix provides the strength of positive, negative, and dark causality, respectively.

Examples

# \donttest{
data(climate_indices)
dataset <- climate_indices[,-1] # remove the date column
result <- pcMatrix(dataset, E = 3, tau = 1, metric = "euclidean", h = 2, weighted = TRUE)
#> CAUSE:  AO 
#> EFFECT:  AO 
#> EFFECT:  AAO 
#> EFFECT:  NAO 
#> EFFECT:  PNA 
#> CAUSE:  AAO 
#> EFFECT:  AO 
#> EFFECT:  AAO 
#> EFFECT:  NAO 
#> EFFECT:  PNA 
#> CAUSE:  NAO 
#> EFFECT:  AO 
#> EFFECT:  AAO 
#> EFFECT:  NAO 
#> EFFECT:  PNA 
#> CAUSE:  PNA 
#> EFFECT:  AO 
#> EFFECT:  AAO 
#> EFFECT:  NAO 
#> EFFECT:  PNA 
#> Calculation duration:  7.96907925605774
print(result)
#> $positive
#>           [,1]      [,2]      [,3]      [,4]
#> [1,]        NA 0.2371795 0.1910828 0.2413793
#> [2,] 0.3241379        NA 0.2711864 0.2101449
#> [3,] 0.1988950 0.2402597        NA 0.1768707
#> [4,] 0.3378378 0.2411348 0.2968750        NA
#> 
#> $negative
#>           [,1]      [,2]      [,3]      [,4]
#> [1,]        NA 0.3846154 0.3694268 0.3448276
#> [2,] 0.1724138        NA 0.2796610 0.3913043
#> [3,] 0.3093923 0.2532468        NA 0.3741497
#> [4,] 0.2702703 0.3687943 0.2421875        NA
#> 
#> $dark
#>           [,1]      [,2]      [,3]      [,4]
#> [1,]        NA 0.3782051 0.4394904 0.4137931
#> [2,] 0.5034483        NA 0.4491525 0.3985507
#> [3,] 0.4917127 0.5064935        NA 0.4489796
#> [4,] 0.3918919 0.3900709 0.4609375        NA
#> 
#> $items
#> [1] "AO"  "AAO" "NAO" "PNA"
#> 
# }