betaFeedback

WorksMathematics

Symmetries of Counterfactuals: Identification and Testability of Counterfactual Maps from Covariate Heterogeneity

Abstract

In general, counterfactuals are not identified from data alone, because many causal models produce the same observed distributions but different counterfactuals. A common approach to circumvent this problem is to restrict the mechanism to a class in which it becomes unique, such as triangular monotone maps or optimal transport maps. However, whether the assumed class is correct is usually not examined. In this work, we study what the data can tell us when covariates are available that influence the outcome only through its latent cause. First, we characterise all counterfactual maps that are consistent with the data. They differ from the true map by a group of symmetries that preserve the conditional outcome distributions given the covariates. The more these distributions vary across covariate values, the smaller the group. Second, we show that for the classes above, consistency with the data is equivalent to a single conditional independence, which yields a test of the assumed class. We illustrate both results on synthetic data and on the ACTG 175 HIV trial.

Introduction

Suppose an HIV-infected patient was treated with zidovudine (ZDV) and their CD4 and CD8 cell counts were measured after 20 weeks. Would the counts have been different had the patient instead received zidovudine plus didanosine (ZDV+ddI)? A randomised trial such as ACTG 175 [6] tells us how the two treatments affect the counts on average, but a personalised recommendation requires us to answer the question for this patient under a treatment they did not receive. Such questions are called counterfactual. Counterfactuals play an important role in medicine, fairness [15], and in explainability of algorithmic decisions [12]. We return to the ACTG 175 example with real data in § 6.2.

Counterfactual questions cannot be answered from data alone (Pearl, 2009). Even if the outcome distributions under both treatments were known exactly, the data would not reveal how individual outcomes are linked across treatments. In general, infinitely many mechanisms (or outcome functions) produce the same observed distributions and give different answers for the same patient.

A common way to circumvent this problem is to restrict the causal model to a structured class in which it becomes unique, for instance triangular monotone maps, as implemented by autoregressive normalising flows [14], or optimal transport maps (Ribeiro et al., 2025). Within such a class the counterfactual is point identified, but different classes give different answers, and whether the assumed class is correct is usually not examined. In general, it cannot be: the class is chosen precisely because, without additional information, the data does not determine the outcome function.

In this work, we ask what the data can say about the outcome function once covariates are available that are associated with the latent cause of the outcome but do not cause the outcome directly. The covariates need not be confounders. What matters is that they are informative about the latent cause, so randomised trials with informative baseline covariates are as useful as observational data. Our contributions are the following.

  • Characterisation of symmetries (§ 4, Theorem 5). The counterfactual maps consistent with the data are exactly the true map composed with a transformation that preserves the conditional outcome distributions given the covariates. These transformations form a group, the symmetry group.

  • Two extremes (Propositions 6 and 7). We show that a heterogeneity condition proposed by Nasr-Esfahany et al. (2023) for continuous treatments makes the symmetry group trivial also for discrete treatments so that counterfactuals are point identified. Without any heterogeneity, every outcome is a possible counterfactual.

  • Testability (§ 5, Theorem 11). For a candidate outcome function, a single conditional independence (CI) condition is equivalent to data consistency and passing the test identifies the counterfactual map up to the symmetry group. Some structural classes single out one outcome function, so testing it becomes a test about the whole structural class. We show how to measure the resolution of the test along rotations of the latent (Proposition 12).

  • Experiments (§ 6). We illustrate the results on synthetic data and apply the CI test to the ACTG 175 trial, where it rejects a reflected map decisively but cannot distinguish the triangular monotone and optimal transport classes. We quantify the resolution of the test on this data.

Background and Problem Setup

This section introduces our notation, recalls structural causal models, and states the assumptions under which our results hold.

Notation. Random variables are denoted by capital letters and their realisations by lower-case letters. We write PXP_X for the distribution of a random variable XX, i.e. the probability measure B↦P(X∈B)B \mapsto P(X \in B), and pXp_X for its density. For a measurable map TT, the pushforward of PXP_X under TT is T#PX:=PT(X)T_{\#}P_X := P_{T(X)}.

Definition 1 (Structural causal model). A structural causal model (SCM) is a tuple M=(X,U,F,PU)\mathcal{M} = (\mathbf{X}, \mathbf{U}, \mathcal{F}, P_U) consisting of endogenous variables X=(X1,…,Xn)\mathbf{X} = (X_1, \ldots, X_n), exogenous variables U=(U1,…,Un)\mathbf{U} = (U_1, \ldots, U_n) with joint distribution PUP_U, and structural functions F={f1,…,fn}\mathcal{F} = \{f_1, \ldots, f_n\} such that Xi=fi((Xk)k∈pa⁡i,Ui)X_i = f_i((X_k)_{k \in\operatorname{pa}_i}, U_i), where pa⁡i⊆{1,…,n}\operatorname{pa}_i \subseteq\{1, \ldots, n\} indexes the direct causes of XiX_i.

An SCM induces a causal graph with nodes X1,…,XnX_1, \ldots, X_n and an edge Xk→XiX_k \to X_i whenever k∈pa⁡ik \in\operatorname{pa}_i, and a distribution PMP^{\mathcal{M}} over X\mathbf{X}. The exogenous variables are unobserved. Two SCMs over the same endogenous variables are observationally equivalent if they induce the same PMP^{\mathcal{M}}. An intervention do⁡(Xi=xi)\operatorname{do}(X_i=x_i) replaces fif_i by the constant xix_i, and we write Mdo⁡(Xi=xi)\mathcal{M}_{\operatorname{do}(X_i=x_i)} for the resulting SCM and PM(X∣do⁡(Xi=xi)):=PMdo⁡(Xi=xi)(X)P^\mathcal{M}(X\mid\operatorname{do}(X_i=x_i)) := P^{\mathcal{M}_{\operatorname{do}(X_i=x_i)}}(X) for the interventional distribution.

Problem setup. Let M=((V,A,Y),(UV,UA,U),F,P(UV,UA,U))\mathcal{M}=((V,A,Y),(U_V,U_A,U),\mathcal{F},P_{(U_V,U_A,U)}) be an SCM where AA takes values in a finite set A\mathcal{A}, YY takes values in Rd\mathbb{R}^{d}, and VV takes values in RdV\mathbb{R}^{d_V}. Let (fa)a∈A(f_a)_{a\in\mathcal{A}} be a family of functions with fa:Rd→Rdf_a:\mathbb{R}^{d}\to\mathbb{R}^{d}.

Assumption 2 We make the following structural assumptions about M\mathcal{M}.

(i) Y=fA(U)Y=f_A(U)

(ii) U⊥ ⁣ ⁣ ⁣⊥A∣VU\perp\!\!\!\perp A\mid V

(iii) fa∈Diff⁡1(Rd)f_a\in\operatorname{Diff}^{1}(\mathbb{R}^{d}) for all a∈Aa\in\mathcal{A}, i.e. faf_a is a bijection with faf_a and fa−1f_a^{-1} continuously differentiable

(iv) Overlap: P(A=a∣V=v)>0P(A=a\mid V=v)>0 for all a∈Aa\in\mathcal{A} and PVP_V-a.e. vv

The causal graph of this SCM is shown in Figure 1.

Figure 1. Causal graph of our setup. The latent variable UU is drawn as a dashed node. The dashed edge between UU and VV denotes that they may be dependent.

The variable YY represents an outcome variable of interest and the variable AA some treatment that effects YY through the function fAf_A. We introduce the following shorthand notation for the distributions we use most often: μ:=PU\mu:=P_U, μv:=PU∣V=v\mu_v:=P_{U\mid V=v}, νa,v:=PY∣A=a,V=v\nu_{a,v}:=P_{Y\mid A=a,V=v}, νa:=PY∣do⁡(A=a)\nu_a:=P_{Y\mid\operatorname{do}(A=a)}. The variable VV is sufficient to control for confounding between AA and YY, because νa=(fa)#μ=∫νa,v dPV(v)\nu_a=(f_a)_\#\mu=\int\nu_{a,v}\,\mathrm{d}P_V(v). The first equality follows from the definition of the interventional distribution and Assumption 2 (i), and the second one from marginalising over VV and using Assumptions 2 (ii) and (iv). We therefore may write νa,v\nu_{a,v} and PY∣do⁡(A=a),V=vP_{Y\mid\operatorname{do}(A=a),V=v} interchangeably.

Definition 3 (Data consistency) We say that an SCM is data consistent if it is observationally equivalent to the true SCM M\mathcal{M}, i.e. its induced data distribution is equal to the observed data distribution PV,A,YP_{V,A,Y}, and if it satisfies Assumption 2.

Definition 4 (Counterfactual map and outcome) We call Ta→a′f:=fa′∘fa−1T^f_{a\to a'}:=f_{a'}\circ f_a^{-1} the counterfactual map from aa to a′a' for outcome function ff. Given an observation (a,y)(a,y), we call Ta→a′f(y)T^f_{a\to a'}(y) the counterfactual outcome of yy under do⁡(A=a′)\operatorname{do}(A=a').

In our setup, this definition corresponds exactly to the classical abduction, action, prediction framework for counterfactual inference proposed by Pearl (2009).

Given an observation (v,a,y)(v, a, y), practical applications often require us to answer the counterfactual question what the outcome yy would have been had the treatment been a′≠aa' \ne a. After reviewing related work in the next section, we will characterise the set of all counterfactual maps that are data consistent in § 4.

Related Work

Non-identifiability and partial identification. For a one-dimensional outcome and a strictly monotone outcome function, counterfactuals are identified: the latent is the rank of the outcome, and the counterfactual map is the quantile-to-quantile map between treatment arms [16] (Nasr-Esfahany and Kiciman 2023). Without monotonicity, counterfactuals are not identified even in one dimension, and Melnychuk et al. (2023) derive bounds that depend on the curvature of the outcome function. In more than one dimension, bijectivity alone does not help: many SCMs with bijective outcome functions induce the same observed distribution but different counterfactuals (Nasr-Esfahany and Kiciman, 2023). Our Theorem 5 describes this set of SCMs exactly, and Proposition 7 shows that without covariate heterogeneity it is as large as it can be.

Point identification through structured classes. To restore point identification, the outcome function is restricted to a class in which it is unique. De Lara et al. [5] use optimal transport maps between the interventional distributions as counterfactual maps. Such maps are unique for a given cost, but they do not compose: transporting from a0a_0 to a1a_1 and then to a2a_2 need not agree with transporting from a0a_0 to a2a_2 directly. Ribeiro et al. (2025) require the outcome functions faf_a themselves to be optimal transport maps from a fixed latent reference distribution η\eta, which yields transitive counterfactual maps but, as we show in Appendix § 8.2.2, makes them depend on the choice of η\eta. The other common class consists of triangular monotone outcome functions, which are unique for any reference distribution and are implemented by autoregressive normalising flows [14, 11, 4]. Deep structural causal models [1] (Pawlowski et al. 2020) learn outcome functions in such classes from data. Closest to our work, Nasr-Esfahany et al. (2023) give a sufficient condition for point identification of bijective outcome functions when covariates of the outcome are available and the treatment is continuous. We adapt it to discrete treatments in Proposition 6 and characterise what remains unidentified when it fails.

Nonlinear ICA. Our setting is related to nonlinear ICA with auxiliary variables. There, a latent variable is observed through an unknown invertible transformation, which is not identifiable from the observed distribution alone [8]. Identifiability up to a restricted class of transformations is recovered when an auxiliary variable modulates the latent distribution sufficiently [7, 13]. In our setup the covariate VV plays the role of the auxiliary variable, and the condition of Proposition 6 is an analogue of the sufficient-variability conditions in that literature. Our target differs: we are interested in the counterfactual map Ta→a′fT_{a\to a'}^f rather than in the latent itself, and we use the auxiliary variable not only for identification but to test a hypothesised model class.

Symmetry Group for Counterfactuals

Before we formally state our characterisation of the set of data consistent counterfactual maps, we provide some intuition. Let us assume for now that AA is binary and we would like to know the counterfactual map from A=0A=0 to A=1A=1. Then we know that this map has to transport the interventional distribution of Y∣do⁡(A=0)Y\mid\operatorname{do}(A=0) to the distribution of Y∣do⁡(A=1)Y\mid\operatorname{do}(A=1). We call this the marginal transport condition and illustrate it in Figure 2 (a). In more than one dimension, there are infinitely many diffeomorphisms that can realise this transport. For example, when ν0\nu_0 is a standard Gaussian, then f1∘f0−1∘Rf_1\circ f_0^{-1}\circ R where RR is a rotation is another such function. However, according to our setup, the counterfactual map also has to transport the conditional distribution of Y∣do⁡(A=0),V=vY\mid\operatorname{do}(A=0),V=v to the distribution of Y∣do⁡(A=1),V=vY\mid\operatorname{do}(A=1),V=v for all vv. We call this the conditional transport condition (Figure 2 (b)). At the same time, the counterfactual map T0→1f=f1∘f0−1T^{f}_{0\to1}=f_1\circ f_0^{-1} does not change with vv because VV is not a direct cause of YY according to Assumption 2 (i). Therefore, every new conditional distribution νa,v\nu_{a,v} adds another restriction, so heterogeneity of νa,v\nu_{a,v} with respect to vv helps to find the correct counterfactual map. This can be seen in Figure 2 (b), where for example the bottom two points cannot be moved to any of the top two points, because Y∣do⁡(A=1),V=v1Y\mid\operatorname{do}(A=1),V=v_1 has no support there. In general the conditional transport condition introduces additional constraints even when the supports overlap.

References

  1. [1]Sourabh Balgi, Adel Daoud, Jose M. Peña, Geoffrey T. Wodtke, and Jesse Zhou. Deep Learning With DAGs. Sociological Methods & Research, 54(4):1624–1682, November 2025. ISSN 0049-1241. doi: 10.1177/00491241251319291. URL https://doi.org/10.1177/00491241251319291.
  2. [2]V I Bogachev, A V Kolesnikov, and K V Medvedev. Triangular transformations of measures. Sbornik: Mathematics, 196(3):309–335, April 2005. ISSN 1468-4802. doi: 10.1070/sm2005v196n03abeh000882.DOI
  3. [3]William M. Boothby. Transitivity of the Automorphisms of Certain Geometric Structures. Transactions of the American Mathematical Society, 137:93–100, 1969. ISSN 0002-9947. doi: 10.2307/1994789. URL https://www.jstor.org/stable/1994789.DOI
  4. [4]Yikang Chen and Dehui Du. Exogenous Isomorphism for Counterfactual Identifiability, May 2025. URL https://arxiv.org/abs/2505.02212. arXiv:2505.02212 [cs.LG].
  5. [5]Lucas De Lara, Alberto González-Sanz, Nicholas Asher, Laurent Risser, and Jean-Michel Loubes. Transport-based counterfactual models. Journal of Machine Learning Research, 25(136):1–59, 2024. URL http://www.jmlr.org/papers/v25/21-1440.html.
  6. [6]Scott M. Hammer, David A. Katzenstein, Michael D. Hughes, Holly Gundacker, Robert T. Schooley, Richard H. Haubrich, W. Keith Henry, Michael M. Lederman, John P. Phair, Manette Niu, Martin S. Hirsch, and Thomas C. Merigan. A Trial Comparing Nucleoside Monotherapy with Combination Therapy in HIV-Infected Adults with CD4 Cell Counts from 200 to 500 per Cubic Millimeter. New England Journal of Medicine, 335(15):1081–1090, October 1996. ISSN 0028-4793, 1533-4406. doi: 10.1056/NEJM199610103351501. URL http://www.nejm.org/doi/abs/10.1056/NEJM199610103351501.DOI
  7. [7]Aapo Hyvarinen, Hiroaki Sasaki, and Richard Turner. Nonlinear ICA Using Auxiliary Variables and Generalized Contrastive Learning. Proceedings of the Twenty-Second International Conference on Artificial Intelligence and Statistics, pages 859–868. PMLR, April 2019. URL https://proceedings.mlr.press/v89/hyvarinen19a.html.arxiv.org/abs/1805.08651
  8. [8]Aapo Hyvärinen and Petteri Pajunen. Nonlinear independent component analysis: Existence and uniqueness results. Neural Networks, 12(3):429–439, April 1999. ISSN 0893-6080. doi: 10.1016/S0893-6080(98)00140-3. URL https://www.sciencedirect.com/science/article/pii/S0893608098001403.DOI
  9. [9]Guido W. Imbens and Whitney K. Newey. Identification and Estimation of Triangular Simultaneous Equations Models without Additivity. Econometrica, 77(5):1481–1512, 2009. ISSN 00129682, 14680262.
  10. [10]G. S. James. Tests of Linear Hypotheses in Univariate and Multivariate Analysis when the Ratios of the Population Variances are Unknown. Biometrika, 41(1/2):19–43, 1954. ISSN 0006-3444. doi: 10.2307/2333003. URL https://www.jstor.org/stable/2333003.DOI
  11. [11]Adrián Javaloy, Pablo Sanchez-Martin, and Isabel Valera. Causal normalizing flows: from theory to practice. In A. Oh, T. Naumann, A. Globerson, K. Saenko, M. Hardt, and S. Levine, editors, Advances in Neural Information Processing Systems, volume 36, pages 58833–58864. Curran Associates, Inc., 2023. doi: 10.52202/075280-2566. URL https://proceedings.neurips.cc/paper_files/paper/2023/file/b8402301e7f06bdc97a31bfaa653dc32-Paper-Conference.pdf.DOI
  12. [12]Amir-Hossein Karimi, Bernhard Schölkopf, and Isabel Valera. Algorithmic Recourse: from Counterfactual Explanations to Interventions. In Proceedings of the 2021 ACM Conference on Fairness, Accountability, and Transparency, FAccT ’21, pages 353–362, New York, NY, USA, March 2021. Association for Computing Machinery. ISBN 978-1-4503-8309-7. doi: 10.1145/3442188.3445899. URL https://dl.acm.org/doi/10.1145/3442188.3445899.DOI
  13. [13]Ilyes Khemakhem, Diederik Kingma, Ricardo Monti, and Aapo Hyvarinen. Variational Autoencoders and Nonlinear ICA: A Unifying Framework. In Proceedings of the Twenty Third International Conference on Artificial Intelligence and Statistics, pages 2207–2217. PMLR, June 2020. URL https://proceedings.mlr.press/v108/khemakhem20a.html.arxiv.org/abs/1907.04809
  14. [14]Ilyes Khemakhem, Ricardo Monti, Robert Leech, and Aapo Hyvarinen. Causal Autoregressive Flows. In Proceedings of The 24th International Conference on Artificial Intelligence and Statistics, pages 3520–3528. PMLR, March 2021. URL https://proceedings.mlr.press/v130/khemakhem21a.html.arxiv.org/abs/2011.02268
  15. [15]Matt J Kusner, Joshua Loftus, Chris Russell, and Ricardo Silva. Counterfactual Fairness. In I. Guyon, U. Von Luxburg, S. Bengio, H. Wallach, R. Fergus, S. Vishwanathan, and R. Garnett, editors, Advances in Neural Information Processing Systems, volume 30. Curran Associates, Inc., 2017. URL https://proceedings.neurips.cc/paper_files/paper/2017/file/a486cd074e4ac3d270571622f4f316ec5-Paper.pdf.arxiv.org/abs/1703.06856
  16. [16]Chaochao Lu, Biwei Huang, Ke Wang, José Miguel Hernández-Lobato, Kun Zhang, and Bernhard Schölkopf. Sample-Efficient Reinforcement Learning via Counterfactual-Based Data Augmentation, December 2020. URL http://arxiv.org/abs/2012.09092. arXiv:2012.09092 [cs.LG].
  17. [17]Robert J. McCann. Existence and uniqueness of monotone measure-preserving maps. Duke Mathematical Journal, 80(2):309–323, November 1995. ISSN 0012-7094, 1547-7398. doi: 10.1215/S0012-7094-95-08013-2. URL https://projecteuclid.org/journals/duke-mathematical-journal/volume-80/issue-2/Existence-and-uniqueness-of-monotone-measure-preserving-maps/10.1215/S0012-7094-95-08013-2.full.DOI

Paper details

vlnc:W_jzhrvkau
Version
v1 · latest
Published
Fresh — added to the Hub within the last 30 days
Added
License
CC BY 4.0
Usage

views · 0

downloads · 0

A view counts once per browser per day, a download each time the PDF is requested.

  • Mathematics

Not recorded for this paper

View statement
Looking for related papers…
Contents