Showing posts with label directed acyclic graph. Show all posts
Showing posts with label directed acyclic graph. Show all posts

Further notes on causation

Some further topics on causal models, as a follow-up to the previous introductory article.

Table of contents

  • Causal models and truth tables
  • The do operator; ceteris paribus
  • d-separation, RCT and the do operator
  • Ancestral graphs
  • Time
  • Newcomb's problem and the limits of CDT

Causal models and truth tables

When first introduced to causal modeling (or for that matter any multivariate modeling that involves looking at conditional distributions), you wondered why one couldn't just directly apply the joint probability distribution to model your data, rather than talk about conditional independences, etc. Well, the standard answer has to do with computational problems with dealing with joint distributions with way too many free parameters, but some insight can be gained from considering the logical analog of the statistical problem.

The logical analog of a joint distribution is a truth table. Well, formally these propositions should be considered quantified over some variable, or over some models with incomplete theories, etc. so the propositions aren't just always true or always false. Then a truth table represents every possible state the propositions could have in any model.

$$\begin{array}{*{20}{c}}{\begin{array}{*{20}{c}}P&Q&R\\\hline0&0&0\\0&1&1\\1&0&1\\1&1&0\end{array}}&{\begin{array}{*{20}{c}}P&Q&R\\\hline0&0&0\\1&1&1\end{array}}\end{array}$$

Above are two possible truth tables for some propositions $P,Q,R$. Causally, they can be represented by the following diagrams respectively.

$$\begin{array}{*{20}{c}}{\begin{array}{*{20}{c}}P& {} &Q\\{}& \searrow & \downarrow \\{}&{}&R\end{array}}&{P \to Q \to R}\end{array}$$

These arrows do not directly represent implication (although they do up to negation), and obviously the precise conditional implications need to be specified to extract the joint distribution, but the causal diagrams tell us, as before, the pattern of conditional independences. Learning the precise distribution given a causal model (i.e. given a causal graph, without knowledge of the precise implications/"conditional distributions" represented by each link) amounts to checking smaller truth tables for each vertex in the causal model.

So for a system with $i$ propositions, learning the truth table directly would take $2^i$ passes, but given a causal model would take $\sum_v 2^{i_v}\sim i2^{i_v}$ passes (where $i_v$ is the number of parents $v$ has), which is far more computationally scalable.

Evaluating models is also more efficient in causal form, although this is less important -- the example models above, in truth table form, respectively read formally as:

$$\left( {\neg P \wedge \neg Q \wedge \neg R} \right) \vee \left( {\neg P \wedge Q \wedge R} \right) \vee \left( {P \wedge \neg Q \wedge R} \right) \vee \left( {P \wedge Q \wedge \neg R} \right)$$

$$(P \wedge Q \wedge R) \vee (\neg P \wedge \neg Q \wedge \neg R)$$

And in causal form, read as (in a way analogous to Markov factorization):

$$\left( {P \vee \neg P} \right) \wedge \left( {Q \vee \neg Q} \right) \wedge \left( {\neg P \wedge \neg Q \to \neg R} \right) \wedge \left( {\neg P \wedge Q \to R} \right) \wedge \left( {P \wedge \neg Q \to R} \right) \wedge \left( {P \wedge Q \to \neg R} \right)$$

$$\left( {P \to Q} \right) \wedge \left( {\neg P \to \neg Q} \right) \wedge \left( {Q \to R} \right) \wedge \left( {\neg Q \to \neg R} \right)$$

While the causal expressions may seem more convoluted, consider the problem of checking whether a given state $(P,Q,R)$ is valid according to our truth table (testing a model in the logical setting amounts to checking whether given data points fit the model). This is a decidable problem -- there is a simple algorithm to reduce any logical expression with given values of $(P,Q,R)$ to a boolean value. Which expression is computationally more feasible to evaluate?

In the first model, the truth table takes 7.5 equality checks, while the causal model takes an average of 10.5 equality checks. In the second model, the truth table takes an average of 5.625 equality checks, while the causal model takes an average of 6 equality checks. But look at how these values scale -- in general for some causal model, the causal model takes the following number of equality checks on average:

$$\sum_{v\in V}{\sum_{w\in 2^I_v}{2-\frac{1}{2^{i_v+o_w}}}}\approx \sum_{v}{2^{i_v+1}}$$

Where $v\in V$ are the vertices (variables) in the model, $w\in 2^{I_v}$ are the $2^{i_v}$ possible configurations of $v$'s $i_v$ causal variables $I_v$, $o_w$ is the number of possibilties left open even after all causal variables are specified (i.e. the noise term). While the truth table takes the following number of equality checks on average:

$$2^i o-\frac{o(o-1)}{2}$$

Where $i$ is the total number of variables and $o$ is the number of allowed states (i.e. the total unexplained variance). For $i_v << i<o$, the causal model is far more efficient to test than the joint distribution. Perhaps some connection can be made to divide-and-conquer or factorization algorithms -- or maybe not, since divide-and-conquer is recursive while this isn't.

The do operator; ceteris paribus

Causation is the idea that crashing cars won't cause people to drink more. It does so within the framework of statistical modeling by observing that "accident rate" and "go crash a car" are two different variables, and when you "go crash a car" in the real world, the precise mechanism by which you do so does not involve increasing people's drinking ability. "Go crash a car" is an instrumental variable, and is typically denoted using Pearl's do operator as do(crash). In the below diagram, releasing storks is "do(stork)".

The do operator captures the basic intuition, or motivation, behind causality. We're interested in finding out what increasing tax rates does to the GDP -- it doesn't matter for our purposes that richer countries tend to have higher taxes for political reasons, we'll change taxes without all that politics -- conditioning on the politics.

What the do operator does is allow us to formalize the notion of ceteris paribus. On first glance, the concept of ceteris paribus seems inherently flawed -- suppose you have four variables: momentum, mass, velocity and crater size; then saying "an increase in mass results in an increase in crater size, ceteris paribus" is ill-defined -- you can't hold velocity and momentum constant while increasing mass.

No, the notion of ceteris paribus is defined with respect to a causal model -- thus, both the following models are ok:


(Our use of the do operator is perhaps non-standard, but equivalent to the standard one. We define $\mathrm{do}(X=x)$ as a random variable with conditional probabilities $P(X=x'\mid\mathrm{do}(X)=x)=\delta_{xx'}$, and $P(X=x'\mid \mathrm{do}(X)=\bot)$ is as before. This becomes equivalent to erasing causal arrows from parents when $\mathrm{do}(X)$ is active. If you let $\mathrm{do}(X)$ be distributed in some way, this captures the notion of a randomized control trial.)

d-separation, RCT and the do operator

The idea of "do" interventions is given formal grounding by the idea of d-separation, which is the basic calculus of causation upon which all experiments to establish causation are based.

Fundamentally, d-separation describes when a causal pathway allows for the "flow of information" (a concept that is also relevant to belief propagation stuff) between random variables. The rules of d-separation follow from the Markov and faithfulness assumptions:

  • In a chain junction $A\to B\to C$, conditioning on $B$ blocks the pathway.
  • In a confounding (fork) junction $A\leftarrow B\to C$, conditioning on $B$ blocks the pathway.
  • In a colliding junction $A\to B\leftarrow C$, the opposite is true: chain starts out blocked, but conditioning on $B$ unblocks it due to the "explain-away effect". For example, a sprinkler may operate independently of the rain, but if you're told that the grass is wet, then they become negatively correlated.
  • Conditioning on the descendant of a variable is like also like conditioning on the variable itself. Conditioning on the descendant of a mediator or confounding variable partially blocks the pathway; conditioning on the descendant of a collider partially unblocks the pathway. This is "partial", in the sense that parent nodes take priority over child nodes in deciding how the pathway is blocked.
So by adding $\mathrm{do}(X)$ to a causal model, $X$ becomes a collider, and so $\mathrm{do}(X)$ can be adjusted independently of $X$'s other parents, thus blocking the flow of information through the parents' causal pathways -- this is also precisely what a randomized control trial does, in which $\mathrm{do}(X)$ is given some distribution.

Ancestral graphs

Here's a somewhat harder example, involving common causes: suppose the true model of smoking and cancer looks like this:

And suppose that risk-averseness is unobserved/not part of our universe. Can we still recover the fact that there is no causal link between smoking and cancer (according to this model) without this common cause being known? In other words, consider the following scenario: a correlation is observed between smoking and cancer, but a randomized experiment shows no increase in cancer from do(Smoking), and no increase in smoking from do(Cancer) either (so you can't just point an arrow from cancer to smoking either). The true model looks something like this:

To simplify, let's consider a logical model -- the truth table looks like this:

Risk do(smoking) smoking do(cancer) cancer
0 0 0 0 0
0 0 0 1 1
1 0 1 0 1
1 0 1 1 1
0 1 1 0 0
1 1 1 0 1
0 1 1 1 1
1 1 1 1 1

And if risk is unobserved:

do(smoking) smoking do(cancer) cancer
0 0 0 0
0 0 1 1
0 1 0 1
0 1 1 1
1 1 0 0
1 1 0 1
1 1 1 1

Well, here's the thing: smoking's parent cannot be do(smoking) alone, because smoking and cancer are not independent once conditioned on do(smoking) -- you can't have smoking and cancer take on different values if do(smoking) is 0. And if you condition on do(smoking) and do(cancer) both, then you can't have smoking and cancer take on different values if do(smoking) and do(cancer) are both 0. So cancer must itself be a parent to smoking -- and by a similar argument, smoking must itself be a parent to cancer. 

Obviously, this is not possible in a DAG, so if we assume that the universe is causal, this data implies the existence of an unobserved hidden cause. Such data -- where some vertices of a DAG are marginalized over -- can be represented with an ancestral graph [1]. The question, then, is how the full DAG can actually be learned from the data, i.e. what the causal structure is, what its distribution is, etc. Some relevant papers: [1][2][3][4] Fundamentally, however, this seems closely related to the problem of causal discovery and representation learning.

Time

One may imagine taking the limit to a continuum of random variables, in which a DAG approaches a partial order. 

It is notable that this is a partial order, and not a total order. This allows for something like relativity, in which time ordering cannot be established for spacelike separated events. Indeed, the causal model of spacetime in special relativity looks like this, and light cones are simply sets of paths in the DAG:


Newcomb's problem and the limits of CDT

An AI offers you two boxes, and gives you the options of choosing either only Box A, or Box A + Box B. It says it has modelled your mind, and set up the boxes based on its predictions of your behavior: Box B will contain £1 no matter what, but Box A will contain £1000 only if you one-box. What do you choose?

Causation is fundamentally a decision-theoretic idea, and Newcomb's problem reveals a fundamental problem with causal decision theory: causal decision theory pretends that the agent is completely independent of the environment -- from physics. In reality, the agent is a "part" of physics -- the $\mathrm{do}(X)$ variable itself has arrows going into it -- 

I believe that causal decision theory should be considered a special case of evidential decision theory in which certain choices can be made "freely", in which true "do" operators exist

A similar problem arises with time travel as in Harry Potter and the Methods of Rationality. Here too there are arrows pointing into $\mathrm{do}(X)$, arising from the causal graph no longer being DAG. 

There was another pause, and then Madam Bones’s voice said, "I have information which I learned four hours into the future, Albus. Do you still want it?" Albus paused— (weighing, Minerva knew, the possibility that he might want to go back more than two hours from this instant; for you couldn’t send information further back in time than six hours, not through any chain of Time-Turners) —and finally said, “Yes, please.”

(Of course, "I have information from four hours into the future" is itself information, as is any such interaction, and indeed if time loops of constant length exist at every point in time then arbitrarily large time loops can be created simply by adding them.)

Statistical models; causal models

A statistical model in the most general sense is a proposed distribution for some random variable. In the simplest case, one can have a univariate distribution, e.g. $X\sim N(\mu, \sigma^2)$ and experiment to get posterior distributions for the values of $\mu$, $\sigma$. 

More generally, the random variable in question may be correlated with some other random variable. Well, the most general way to express such a model is via its joint distribution, but the joint distribution might be too expensive to reasonably test -- a classic example is that of causal relationship.

However, there are various special cases of this general description that naturally capture the assumptions that one would make while attempting to model these variables: 

  • Hierarchical/Causal model: We arrange the random variables in a tree-like format, with each parent's distribution taking the value of its child random variables as an explanatory variable -- the distribution of each node is marginalized against the distribution of its parents so that it only depends on its own children. E.g. $Y\sim N(\mu_{0Y} + \mu_{1Y} X, 1)$, $X\sim N(\mu_X, 1)$. 
  • Exogenous variables: We don't bother about the distribution of the explanatory variables, treating them as "exogenous variables". In the context of decision theory, these should be seen as variables which we can manipulate at will -- e.g. if we're discussing the effects of taxation on GDP growth, then tax rates should be seen as an exogenous variable (even though it might be true that the tax rate is actually influenced by voter priorities and can be predicted in such way -- that's just not the question we're interested in addressing). Essentially, we are only interested in modeling the conditional distribution.



Causation

So causation is different from correlation, and closely related to partial correlation

To illustrate what we mean, consider this highly publicized study (reported e.g. here) arguing that higher taxes benefit the economy, because the U.S. economy grew slightly faster in the 1960s when taxes were higher. This study had a host of other problems (see the p-hacking article, where I point out that doing an experimental study on such noisy data is meaningless in the absence of a solid theoretical backing for your claim), but the main problem was that there are a lot of differences between the 1960s and now apart from tax rates, e.g. regulations were fewer in the 1960s, the kinds of industries and their accounting in GDP were different in the 1960s. 

The fundamental problem is this: the question you want to answer is "what will be the effect of increasing taxes be on economic growth?" Since it is unlikely that increasing taxes will reduce regulations or change accounting methods, we want to remove the contributions of these correlations in the explanatory variables from the correlation between tax rates and economic growth.

(The obvious solution would be to take cross-sectional data (comparing the U.S. to countries that had different time trends in their tax rates) instead of longitudinal data -- this is an example of randomized interventions, or reasoning on the joint probability distribution.)

This is the idea behind partial correlations. To study the causal link between a dependent variable $Y$ and an independent variable $X_i$ means to study the conditional distribution of $Y\mid X_{j\ne i}$.

Notice how this definition completely depends on the random variables we have chosen to control. For example, if we had also controlled for some economic variables that taxation affects GDP growth "through", the effect of changing taxation would perhaps be smaller. The choice of these variables depends on our purpose -- i.e. based on what we're actually able to control.

Apply this reasoning to the context of a classic example: since wind speed correlates with the rotation of a windmill, does this mean the windmill rotation affects wind speed? What are we really asking here? What are our variables (you should have at least 3 of them)?

We can also immediately carry over constructions from correlation to causation. We define the partial correlation of $Y\mid X_{j\ne i}$ as the value of the correlation computed from the conditional distribution of $Y\mid X_{j\ne i}$, and may geometrically be interpreted as the $\cos\theta$ of the projections of $Y$ and $X_i$ (as vectors) onto the orthogonal complement of the span of the controlled variables (therefore eliminating the correlations $Y$ and $X_i$ have with them).



Causal models

It is important to note that the existence of partial correlation is not actually equivalent to causation either. Causation is an underlying explanation -- it is represented in the form of causal networks, which are directed acyclic graphs that are models of the underlying behavior of the system. It's much like how quarks are an underlying model of the observed particle zoo -- the quarks themselves cannot be observed, but they form a framework on which predictions can be made.

So a causal model might look like this:


With distributions $f_T$, $f_{X_1\mid T}$, $f_{X_2\mid T}$, $f_{Y\mid X_1, X_2}$. 

\[{f_{T,{X_1},{X_2},Y}}(t,{x_1},{x_2},y) = {f_{Y\mid {X_1},{X_2}}}(y\mid {x_1},{x_2}){f_{{X_1}\mid T}}({x_1}|t){f_{{X_2}\mid T}}({x_2}|t){f_T}(t)\]

So the idea is that multiple different causal models may be equivalent in the sense that they lead to the same joint distribution -- saying that something causes another thing is not an absolute truth, but simply a model that is consistent with the truth. If two models lead to an identical joint distribution, they are "equivalent" for all physical purposes.

E.g. consider the following models:




Then the joint distribution corresponding to each causal model is:

\[{f_{ABR}}(a,b,r) = {f_{A\mid B}}(a\mid b){f_{B\mid R}}(b\mid r){f_R}(r) = \frac{{f(a,b)f(b,r)}}{{f(b)}}\]
\[{f_{ABR}}(a,b,r) = {f_{R\mid B}}(r\mid b){f_{B\mid A}}(b\mid a){f_A}(a) = \frac{{f(a,b)f(b,r)}}{{f(b)}}\]
\[{f_{ABR}}(a,b,r) = {f_{A\mid B}}(a\mid b){f_{R\mid B}}(r\mid b){f_B}(b) = \frac{{f(a,b)f(b,r)}}{{f(b)}}\]

Which are equivalent.

On the other hand, the following three models:



\[{f_{ABR}}(a,b,r) = {f_{A\mid B}}(a\mid b){f_{B\mid R}}(b\mid r){f_R}(r) = \frac{{f(a,b)f(b,r)}}{{f(b)}}\]
\[{f_{ABR}}(a,b,r) = {f_{B\mid A,R}}(b\mid a,r){f_B}(b){f_R}(r)\]
\[{f_{ABR}}(a,b,r) = {f_{B\mid A}}(b\mid a){f_{A\mid R}}(a\mid r){f_R}(r) = \frac{{f(a,b)f(a,r)}}{{f(a)}}\]

Are not equivalent, and can thus be distinguished by experiment.

Because this equivalence is a property of graphs, we expect to be able to read off equivalences from simply glancing at the causal trees. The key idea here is that a causal tree is defined by assumptions of conditional independence (because causation is about conditional independence), and so the equivalence of two trees means that they have the same pattern of conditional independence. Reading off patterns of conditional independence is known as D-separation.