causalcompass.datasets.confounder.simulate_var_with_confounders
- causalcompass.datasets.confounder.simulate_var_with_confounders(p, T, lag=3, rho=0.5, sparsity=0.2, beta_value=1.0, sd=0.1, burn_in=100, seed=0)[source]
Generate VAR data with cross-lag hidden confounders that introduce spurious correlations.
- Parameters:
p (int) – Number of variables
T (int) – Number of time points
lag (int, default 3) – Number of lags in the VAR model
rho (float, default 0.5) – Probability of confounding between each pair of variables
sparsity (float, default 0.2) – Sparsity of the causal graph
beta_value (float, default 1.0) – Coefficient value
sd (float, default 0.1) – Noise standard deviation
burn_in (int, default 100) – Burn-in period
seed (int, default 0) – Random seed
- Returns:
(data, beta, GC) — time series array of shape (T, p), coefficient matrix, and ground-truth causal graph of shape (p, p)
- Return type:
tuple