Declarative Causal Inference and Counterfactual Reasoning via SQL-Dialect Operators
Year: 2026
Type: article
Abstract: Relational databases power high-stakes decisions in lending, healthcare, and justice, yet SQL lacks native constructs for causal and counterfactual reasoning. Prior SQL-based causal systems address parts of this gap but do not unify treatment-effect estimation with counterfactual generation in a single, composable SQL surface. We present a system that extends the SQL dialect with two declarative operators: EXPLAIN_CAUSALLY_WHY (ψ) for estimating average and conditional treatment effects via meta-learners, and EXPLAIN_COUNTERFACTUAL (φ) for generating diverse, constraint-respecting alternatives via a hybrid KD-tree/LSH pipeline. Both operators consume standard SQL relations (joins, filters, projections) and return table-valued results with optional diagnostics, confidence intervals, and feasibility metrics. We formalize the operators in relational algebra, and describe our prototype system called PsiQL. On four evaluation datasets, PsiQL recovers a protective TWINS treatment effect, returns a non-significant COMPAS point ATE with imbalance diagnostics, flags HMDA covariate imbalance via built-in SMD checks, and generates constraint-respecting counterfactuals; a synthetic Census run serves as a balanced pipeline proof-of-concept alongside a real ACS diagnostic under severe imbalance.
Source: Big Data and Cognitive Computing
DOI: 10.3390/bdcc10080275
Authors: Ronnit Peter, Suprio Ray, Moulay A. Akhloufi
Institutions: University of New Brunswick, Université de Moncton
Language: English
Subfield: Statistics and Probability
Field: Mathematics
Domain: Physical Sciences
Open Access status: gold
Estimated APC paid: $2,172
Award: G994121499
OpenAlex ID: W7203607340
