# Regression: Causal Inference can be Trivial

Assume for now that we are given a set of data points drawn from this graph $G$:

[] \begin{align} D = \left\{ (a_1, y_1, x_1), \ldots, (a_N, y_N, x_N) \right\}. \end{align} []

For every instance, we observe all of the action $a$, outcome $y$ and covariate $x$. Furthermore, we assume all these data points were drawn from the same fixed distribution

[] \begin{align} p^*(a, y, x) = p^*(x) p^*(a|x) p^*(y|a,x) \end{align} []

and that $N$ is large. In this case, we can use a non-parametric estimator, such as tables, deep neural networks and gradient boosted trees, to reverse-engineer each individual conditional distribution from this large dataset $D$. This is just like what we have discussed earlier in \SLearning and a generative process. Among three conditional distributions above, we are only interested in learning $p^*(x)$ and $p^*(y|a,x)$ from data, resulting $p(x;\theta)$ and $p(y|a,x;\theta)$, where $\theta$ refers to the parameters of each deep neural network.[Notes 1] Once learning is over, we can use it to approximate ATE as

[] \begin{align} \mathrm{ATE} &\approx \sum_{y} y \mathbb{E}_{x \sim p(x;\theta)} \left[ p(y|a=1, x; \theta) \right] - \sum_{y} y \mathbb{E}_{x \sim p(x;\theta)} \left[ p(y|a=0, x; \theta) \right] \\ &= \sum_{y} y \mathbb{E}_{x \sim p(x;\theta)} \left[ p(y|a=1, x; \theta) - p(y|a=0, x; \theta) \right]. \end{align} []

There are two conditions that make this regression-based approach to causal inference work:

• No unobserved confounder: we observe the covariate $x$ in $G$;
• Large $N$: we have enough examples to infer $p^*(y|a,x)$ with a low variance.

If there is any dimension of $x$ that is not observed in the dataset, it is impossible for any learner to infer neither $p^*(y|a,x)$ nor $p^*(x)$ correctly. “Correctly” here in particular refers to identifying the true $p^*(y|a,x)$. This is not really important if the goal is to approximate the conditional probability $p^*(y|a)$, since we can simply drop $x$ and use $(a,y)$ pairs. It is however critical if the goal is to approximate the interventional probaiblity $p^*(y|\mathrm{do}(a))$ because this necessitates us to access $p^*(y|a,x)$ (approximately). Large $N$ is necessary for two reasons. First, the problem may be ill-posed when $N$ is small. Consider rewriting $p(y|a,x)$ as

[] \begin{align} p(y|a,x) = \frac{p(y,a,x)}{p(a|x)p(x)}. \end{align} []

This quantity has in the denominator both $p(a|x)$ and $p(x)$. If $N$ is small to the point that we do not observe all possible combination of $(a,x)$ for which $p(x) \gt 0$, this conditional probability is not well-defined. This connects to one of the major assumptions in causal inference, called positivity, which we will discuss further later in the semester. The second, perhaps less important, reason is that the variance of the estimator is often inversely proportional to $N$. That is, with more $N$, we can approximate $p^*(y|a,x)$ with less variance. The variance of this estimate is critical, as it directly leads to that of ATE. If the variance of ATE is high, we cannot draw a confident conclusion whether the treatment is effective. This section tells us that causal inference can be done trivially by statistical regression when the following conditions are satisfied:

• There are no unobserved confounder: We observe every variable.
• Positivity: All possible combinations of $(a,y,x)$ are observed in data.
• We have enough data.

Unfortunately, it is rare that all these conditions are satisfied in real life.

## General references

Cho, Kyunghyun (2024). "A Brief Introduction to Causal Inference in Machine Learning". arXiv:2405.08793 [cs.LG].

## Notes

1. Although there is no reason to prefer deep neural networks over random forests or other non-parametric learners, we will largely stick to deep neural networks, as I like them more.