Abstract
The gadjid R package provides efficient Rust implementations of graph adjustment identification distances. These metrics—based on ancestor, optimal, and parent adjustment—quantify how frequently a specific adjustment strategy leads to incorrect causal inferences when applied to a candidate graph compared to a ground-truth graph. By leveraging high-performance computing, gadjid facilitates large-scale evaluation of causal discovery algorithms. See also Henckel, Würtzen, Weichwald (2024) doi:10.48550/arXiv.2402.08616.
Introduction: The Causal Utility Gap
In the field of causal discovery, researchers frequently employ algorithms to estimate causal structures, typically represented as Directed Acyclic Graphs (DAGs), from observational data. Evaluating the performance of these algorithms requires metrics that measure the "distance" between an estimated graph and the true underlying structure.
Historically, the Structural Hamming Distance (SHD) has been the standard metric. However, SHD merely counts edge differences (additions, deletions, or reversals) without considering their causal implications. A single edge difference might be structurally minor but causally catastrophic, or vice versa. While the Structural Intervention Distance (SID) offers a more causal perspective, it is often computationally prohibitive for large-scale graphs. The gadjid package bridges this gap by providing efficient, adjustment-set-focused metrics.
The gadjid Framework: High-Performance Causal Metrics
The gadjid package implements theoretical advancements focusing on Adjustment Identification Distances (AID). These distances measure the utility of a graph for downstream causal inference by checking if the adjustment sets it suggests are valid in the true graph. If an estimated graph suggests an adjustment set that fails in the true graph, gadjid quantifies that failure.
The core innovation of gadjid lies in its implementation. By using the rextendr framework to wrap high-performance Rust code, the package handles complex graph reachability algorithms with significantly greater speed than pure R implementations. This allows researchers to shift focus from simple structural accuracy to the practical causal utility of their models.
Key Metrics and Usage
The package provides several specialized functions to evaluate different adjustment criteria:
ancestor_aid: Calculates distances based on the ancestor adjustment criterion.parent_aid: Uses the parent adjustment criterion. Notably, for DAGs, this metric reduces to the SID, providing a highly optimized path to calculate intervention distances.oset_aid: Based on the optimal adjustment set (O-set) criterion.
Performance and Scalability
A primary advantage of gadjid is its computational efficiency. Traditional R-based implementations of causal distances struggle as the number of nodes increases. By offloading reachability logic to Rust, gadjid enables benchmarks on graphs with hundreds of nodes (e.g., 400-node random DAGs) that were previously impractical on standard workstations.
Furthermore, the package provides both raw error counts and normalized values (ranging from 0 to 1). This normalization allows researchers to compare algorithm performance across different graph sizes and densities consistently.
Conclusion
The gadjid package represents a significant step forward for the causal discovery community. By shifting the focus from structural accuracy to causal utility and providing the computational tools to measure it efficiently, it allows for more meaningful evaluation of discovery algorithms. While the current version focuses on DAGs and CPDAGs, its performance-first architecture sets a new standard for causal metric software. As causal inference becomes increasingly central to data science, tools that prioritize the validity of adjustment sets will be essential for ensuring robust policy and intervention decisions.
Summary updated