
Enumerate bootstrap paths between two variables in a VAR-LiNGAM model
Source:R/lingam_var_bootstrap.r
get_var_paths.RdBuilds the time-expanded graph for every bootstrap sample and enumerates all
directed paths from the source (at from_lag) to the destination (at
to_lag), reporting each path's bootstrap probability and median effect.
Port of the Python reference VARBootstrapResult.get_paths.
Usage
get_var_paths(
result,
from_index,
to_index,
from_lag = 0,
to_lag = 0,
min_causal_effect = NULL
)Details
Node indices in the returned path are 1-based positions in the time-expanded
graph: column j of block L (lag L) corresponds to index n_features * L + j.
Examples
s <- generate_varlingam_sample(n = 500, seed = 42)
bs <- lingam_var_bootstrap(s$data,
n_sampling = 10L, criterion = NULL,
reg_method = "ols", prune = FALSE, seed = 1, verbose = FALSE
)
get_var_paths(bs, from_index = 1, to_index = 3)
#> path effect probability
#> 1 1, 2, 3 -0.3077611427 1
#> 2 1, 3 -0.0007678152 1