AI Wiki中文/EN

Structural causal models: one equation per mechanism

结构因果模型

Write a causal model as one assignment per variable, compute an intervention by replacing an equation, solve the changed model for one unit to get a counterfactual, and see two models that agree on all observational and experimental numbers yet disagree on the counterfactual.

On this pageIntuitionMathematics & methodImplementationLimitationsExercisesResearch connections

One equation per cause, three kinds of question

A structural causal model (SCM) is a short list of equations, one per variable, that says how each variable is produced from its direct causes. Replacing one equation simulates an action, such as giving a treatment to everyone. Solving the equations again for one particular case answers “what would have happened here if things had been different?” Structural equations

Here is a small example. A hidden factor UU raises both XX and YY, and XX also raises YY directly. The model has three lines: UU is random noise, X:=0.8U+noiseX := 0.8U + \text{noise}, and Y:=1.5X+1.2U+noiseY := 1.5X + 1.2U + \text{noise}. The sign :=:= means “is set to”, like assignment in a program. It runs one way: XX feeds into YY, not the reverse. Assignment reading

The same three lines answer three different questions. If you only watch the data, YY rises by about 2.09 for each extra unit of XX, because UU pushes both up. If you set XX yourself, YY rises by exactly 1.5, because your choice no longer depends on UU. And for one case seen with X=1X=1 and Y=3Y=3, the model says YY would have been 1.50 if XX had been 0. All three numbers come from the synthetic program in the implementation section.

Two terms come up often. Endogenous variables are the ones the model explains, here XX and YY. Exogenous or background variables are causes the model leaves unexplained, here UU and the noise terms. A background variable is not a regression residual. A regression residual is uncorrelated with the predictors by construction. A background factor is part of reality and may be correlated with other variables. Background factors

The three questions match the three rungs of what Pearl calls the ladder of causation. Rung one is association: what tends to go together. Rung two is intervention: what happens if we act. Rung three is the counterfactual: what would have happened in this specific case. In Pearl’s account, a question on one rung needs information from that rung or a higher one. Three-layer hierarchy

This article treats the model itself. The overall framework is in causal inference, and the diagram rules (d-separation, faithfulness) are in causal graphs. It helps to know conditional probability and linear regression. A Bayesian network uses the same kind of factorization without the causal reading. The Judea Pearl article gives a historical two-model example; the one here goes one rung further.

Definition, interventions, counterfactuals and the ladder

This section defines an SCM, shows how an intervention changes it, shows how a counterfactual is computed for one unit, and explains why the three rungs need different information.

From path diagrams to assignments

Pearl traces the first mathematical attempt to write causal relations to Sewall Wright’s path analysis of 1921. Wright combined linear equations such as y=βx+uYy=\beta x+u_Y with a diagram of arrows from causes to effects. Section 3.1, p. 103

An ordinary equation is symmetric. The line y=βx+uYy=\beta x+u_Y can be rewritten as x=(y−uY)/βx=(y-u_Y)/\beta, which looks just as true. Algebra alone therefore cannot say which way influence runs. Pearl’s structural reading is a process: Nature looks at xx and uYu_Y and then assigns a value to yy. Eqs. (1)–(2), pp. 103–104 That is why this article writes :=:= instead of ==.

The definition

Schölkopf and co-authors define an SCM over variables X1,…,XnX_1,\dots,X_n arranged on a directed acyclic graph (a diagram of arrows with no loops). Eq. (3), p. 5

Xi:=fi(PAi,Ui),i=1,…,nX_i := f_i(\mathrm{PA}_i, U_i), \qquad i = 1,\dots,n

In words: each variable XiX_i is produced by its own mechanism fif_i from its direct causes PAi\mathrm{PA}_i (its parents) and its own unexplained factor UiU_i. In their definition the noise terms UiU_i are jointly independent. They note what dependent noise terms would mean: some further common cause would explain the dependence. The model would then not be causally sufficient, that is, it would be missing a shared cause. Joint independence, p. 5

The functions need not be linear. Pearl’s nonparametric version writes, for a chain, z=fZ(uZ)z=f_Z(u_Z), x=fX(z,uX)x=f_X(z,u_X) and y=fY(x,uY)y=f_Y(x,u_Y). Leaving a variable out of a function’s argument list is a claim: Nature ignores that variable when setting this one. Eq. (5), p. 107 In a diagram, a missing arrow claims zero direct influence, and a missing dashed double arrow claims that two background factors are uncorrelated. Missing links, p. 105

Pearl calls such a set of functions structural when each one is autonomous. Autonomous means it stays the same if the form of the other functions changes. He credits this idea to Simon (1953) and Koopmans (1953). Autonomy, p. 107 The arrows of the model’s diagram point from the arguments of each fif_i to XiX_i. What those diagrams imply about independence is the subject of causal graphs.

Markovian models and the factorization

Pearl calls a model Markovian if its diagram has no cycles and all its background terms are jointly independent. Section 3.2.3, p. 110

P(v1,…,vn)=∏iP(vi∣pai)P(v_1,\dots,v_n) = \prod_{i} P(v_i \mid pa_i)

In words: for a Markovian model, the joint probability of all variables is a product of one factor per variable. Each factor is the probability of viv_i given the values paipa_i of its parents, and it stands for one mechanism. Pearl states this as Theorem 1, the causal Markov condition. Theorem 1, eq. (15) He adds that in a Markovian model every causal effect is identifiable, meaning computable from the observed distribution. This presupposes that every variable in the model is observed. Pearl contrasts it with non-Markovian models, whose background terms are correlated through unmeasured confounders and which allow identification only under certain conditions. Section 3.2.3, p. 110 In the example above, UU is hidden, so the claim does not apply to the observed pair (X,Y)(X,Y).

Interventions: replace one equation

Pearl’s do-operator writes an intervention as do(X=x)do(X=x). It deletes the equation for XX, puts the constant xx in its place, and keeps every other equation unchanged. The result is a modified model MxM_x. The post-intervention distribution is then defined as PM(y∣do(x)):=PMx(y)P_M(y\mid do(x)) := P_{M_x}(y): the distribution of YY in the modified model. Eqs. (6)–(7), pp. 107–108 A causal effect is a contrast between two such quantities, for example E(Y∣do(x′))−E(Y∣do(x))E(Y\mid do(x'))-E(Y\mid do(x)). Eqs. (8)–(9), p. 108

For a Markovian model this has a simple probability form, which Pearl gives as Corollary 1. Eq. (17), p. 111

P(v1,…,vn∣do(X=x))=∏i: Vi∉XP(vi∣pai)∣X=xP(v_1,\dots,v_n \mid do(X=x)) = \prod_{i:\, V_i \notin X} P(v_i \mid pa_i)\Big|_{X=x}

In words: to intervene, drop the factors of the variables you set, plug the set value xx into all remaining factors, and leave those mechanisms unchanged. The formula applies to value combinations vv that agree with xx; the others get probability zero. This is the truncated factorization. Pearl notes that Spirtes and co-authors (1993) called it the “Manipulation Theorem” and that it is implicit in Robins’ (1987) G-computation formula. Footnote 8 The same rule handles several variables set at once. Eqs. (21)–(22), p. 112 In diagram terms, setting XX removes the arrows into XX. Schölkopf and co-authors describe it as disconnecting the variable from its parents. Section III-D, p. 6

Not every intervention fixes a constant. Schölkopf and co-authors separate three kinds. A hard (perfect) intervention sets a variable to a constant. A soft (imperfect) intervention changes its function or noise, so the variable still responds to its parents in a new way. An uncertain intervention is one where the learner does not know which mechanism changed. Interventions, pp. 5–6

Why a structural coefficient is an effect

Take the linear structural equation y=βx+uYy=\beta x+u_Y. Pearl derives what happens under do(X=x)do(X=x). Eq. (14), p. 110

y=βx+uY  ⇒  E[Y∣do(X=x)]=βxy = \beta x + u_Y \;\Rightarrow\; E[Y \mid do(X=x)] = \beta x

In words: once XX is set to xx from outside, YY equals βx\beta x plus a background term. The setting does not change that term’s mean, so the coefficient β\beta is the effect of XX on YY. Pearl stresses that this holds however XX was chosen and even when UXU_X and UYU_Y are correlated. Such correlation only makes β\beta harder to estimate from passive data. The structural equation by itself says nothing about the ordinary regression quantity E(Y∣X=x)E(Y\mid X=x). Section 3.2.2, p. 110 The example in this article makes that gap visible: β=1.5\beta=1.5, while the regression slope is about 2.09.

Counterfactuals for one unit

Pearl identifies a unit, such as one person, with its vector uu of background values. The functions are the same for every unit; only uu differs. p. 120 A counterfactual is then defined by solving a modified model for that unit. Definition 4, eq. (27)

Yx(u):=YMx(u)Y_x(u) := Y_{M_x}(u)

In words: to find the value YY would have taken for unit uu had XX been xx, run the modified model MxM_x with that unit’s background values uu. “Had XX been xx” is read as the smallest change that does the job: replace XX‘s equation by the constant xx.

Usually we do not know uu directly; we only see some evidence about the unit. Pearl’s linear example shows how to proceed. The model is x=uXx=u_X and y=βx+uYy=\beta x+u_Y. A unit is observed with X=x0X=x_0 and Y=y0Y=y_0. The second equation then fixes uY=y0−βx0u_Y=y_0-\beta x_0. Setting X=x1X=x_1 and solving gives Yx1=β(x1−x0)+y0Y_{x_1}=\beta(x_1-x_0)+y_0, with probability one. p. 121 The recipe has three plain steps. First, use the evidence to work out what can be known about the unit’s background values. Second, replace the equation of the variable you change. Third, solve the modified model with those background values.

In nonlinear models the evidence usually narrows uu down only partly. The answer then depends on the distribution of the background variables as well. For that reason Pearl says attribution questions (did XX cause this outcome for this unit?) are generally not identifiable in nonparametric models. p. 121 They cannot be settled by experiments either, because no individual can be observed both with and without treatment. Footnote 11, p. 119 Joint statements such as ”Yx=yY_x=y and Yx′=y′Y_{x'}=y'” still get a well-defined probability in an SCM. Each part is evaluated in its own modified model with the same uu. p. 121

The potential-outcome notation used in causal inference writes the same quantity as YxY_x. In Pearl’s account, its basic rules follow from the structural definition. One is consistency: if X=xX=x actually happened, then Yx=YY_x=Y. Eqs. (36)–(38), pp. 127–128 Missing arrows become exclusion restrictions, and missing dashed arcs become independence restrictions on potential outcomes. Eqs. (41)–(42), pp. 131–132 Hernán and Robins also tie causal diagrams to a structural model, a nonparametric structural equation model (NPSEM). They flag a difference in assumptions, though. Pearl usually assumes mutually independent errors (a model they call NPSEM-IE), which makes many more independence assumptions than Robins’ FFRCISTG model. Technical Points 6.2–6.3, pp. 77–78

The ladder of causation

Pearl’s 2018 report lays the three kinds of question out as a hierarchy. pp. 1–2, Fig. 1 The example questions in the last column are ours, phrased for the article’s model.

RungPearl’s nameTypical expressionExample question (ours)
1AssociationP(y∣x)P(y\mid x)Among cases with X=1X=1, what is YY on average?
2InterventionP(y∣do(x),z)P(y\mid do(x),z)If we set X=1X=1 for everyone, what is YY on average?
3CounterfactualP(yx∣x′,y′)P(y_x\mid x',y')This case had X=1X=1 and Y=3Y=3. What would YY have been with X=0X=0?

Pearl writes that questions on rung ii can be answered only with information from rung ii or higher, and that counterfactuals need functional models, meaning structural equations or their properties. pp. 1–2 The report states this informally; we did not read a formal proof.

Schölkopf and co-authors make the same point by comparing model types. A causal graphical model, meaning a graph plus the conditional distributions of each variable given its parents, predicts the effect of interventions. Only an SCM also gives counterfactuals, because a counterfactual needs fixed values of the noise. Many different SCMs, with different functions and noise, produce the same conditional distributions. Section III-D, p. 6 Table I, p. 3 They also note that the two kinds of query form a continuum. A query P(A∣B,do(C))P(A\mid B, do(C)) is a plain intervention when BB is empty and a full counterfactual when BB pins down all the noise terms. Footnote 2, p. 3 Part B of the example below builds two such SCMs.

Independent mechanisms

Autonomy has a probabilistic cousin. Schölkopf and co-authors state the independent causal mechanisms (ICM) principle: the process that generates the data is made of autonomous modules that do not inform or influence each other. In probability terms, the conditional distribution of each variable given its causes tells you nothing about the other mechanisms. Their example is altitude and temperature. The mechanism P(temperature∣altitude)P(\text{temperature}\mid\text{altitude}) may be nearly the same in different countries, while the distribution of altitudes differs. Section IV, pp. 6–7 They present it as a principle, a working assumption, not a theorem.

Seeing, doing and imagining in a synthetic model

This section runs two original synthetic examples and reads every printed number. The program uses numpy and the standard library, with a fixed seed. It uses no real data.

Part A is the linear model from the opening. All noises are standard normal.

U:=NU,X:=0.8 U+NX,Y:=1.5 X+1.2 U+NYU := N_U,\qquad X := 0.8\,U + N_X,\qquad Y := 1.5\,X + 1.2\,U + N_Y

In words: a hidden factor UU raises XX by 0.8 per unit. YY gets 1.5 per unit of XX plus 1.2 per unit of UU. Each of UU, XX and YY also has its own independent noise NN.

Part B is a constructed pair of binary models. UXU_X and UYU_Y are independent coin flips that are 1 with probability 0.5. Model M1 sets X:=UXX := U_X and Y:=X⊕UYY := X \oplus U_Y, where ⊕\oplus is exclusive or (1 when exactly one input is 1). Model M2 sets X:=UXX := U_X and Y:=UYY := U_Y. The program enumerates the four equally likely background combinations exactly.

# Original synthetic SCMs: seeing, doing and imagining (no real data).
import itertools
import numpy as np

rng = np.random.default_rng(16)
N = 500_000
BETA, GAMMA, ALPHA = 1.5, 1.2, 0.8

print("Part A. Linear SCM with a hidden common cause U")
print("  U := N_U,  X := 0.8 U + N_X,  Y := 1.5 X + 1.2 U + N_Y  (all noises N(0,1))")
u, nx, ny = rng.standard_normal((3, N))
x = ALPHA * u + nx
y = BETA * x + GAMMA * u + ny
slope = np.cov(x, y)[0, 1] / np.var(x, ddof=1)
exact_slope = BETA + GAMMA * ALPHA / (ALPHA ** 2 + 1)
print(f"  rung 1, regression slope of Y on X: {slope:.4f} (exact {exact_slope:.4f})")


def y_under_do(x_value):
    # mutilated model: X's equation replaced by the constant x_value, same noises
    return BETA * x_value + GAMMA * u + ny


eff = y_under_do(1.0).mean() - y_under_do(0.0).mean()
print(f"  rung 2, E[Y|do(X=1)] - E[Y|do(X=0)]: {eff:.4f} (exact {BETA:.4f})")
near1 = np.abs(x - 1.0) < 0.05
print(f"  seeing X near 1: E[Y | X~1] = {y[near1].mean():.4f} (exact {exact_slope:.4f});"
      f"  doing X = 1: E[Y|do(X=1)] = {y_under_do(1.0).mean():.4f} (exact 1.5000)")

x_obs, y_obs = 1.0, 3.0
w = y_obs - BETA * x_obs                      # step 1: infer this unit's background term 1.2 U + N_Y
y_cf = BETA * 0.0 + w                         # steps 2-3: set X to 0, keep the background term, solve for Y
print(f"  rung 3, unit with X=1, Y=3: background term 1.2U+N_Y = {w:.2f}; Y had X been 0 = {y_cf:.2f}")

print("\nPart B. Two binary SCMs that agree on rungs 1 and 2 but not on rung 3")
print("  M1: X := U_X, Y := X xor U_Y      M2: X := U_X, Y := U_Y   (U_X, U_Y ~ Bernoulli(0.5))")


def model(name, ux, uy, do_x=None):
    xv = ux if do_x is None else do_x
    yv = (xv ^ uy) if name == "M1" else uy
    return xv, yv


for name in ("M1", "M2"):
    obs = {}
    for ux, uy in itertools.product((0, 1), repeat=2):
        key = model(name, ux, uy)
        obs[key] = obs.get(key, 0) + 0.25
    p_y_x1 = obs.get((1, 1), 0) / (obs.get((1, 0), 0) + obs.get((1, 1), 0))
    p_do = [sum(0.25 * model(name, ux, uy, do_x=v)[1]
                for ux, uy in itertools.product((0, 1), repeat=2)) for v in (0, 1)]
    # counterfactual: among units with X=1, Y=1, would Y have been 1 had X been 0?
    num = den = 0.0
    for ux, uy in itertools.product((0, 1), repeat=2):
        if model(name, ux, uy) == (1, 1):
            den += 0.25
            num += 0.25 * model(name, ux, uy, do_x=0)[1]
    print(f"  {name}: P(X,Y) cells = {[obs.get(k, 0) for k in [(0,0),(0,1),(1,0),(1,1)]]}, "
          f"P(Y=1|X=1) = {p_y_x1:.2f}, P(Y=1|do(X=0)) = {p_do[0]:.2f}, "
          f"P(Y=1|do(X=1)) = {p_do[1]:.2f}, P(Y_(X=0)=1 | X=1,Y=1) = {num / den:.2f}")

The program prints:

Part A. Linear SCM with a hidden common cause U
  U := N_U,  X := 0.8 U + N_X,  Y := 1.5 X + 1.2 U + N_Y  (all noises N(0,1))
  rung 1, regression slope of Y on X: 2.0867 (exact 2.0854)
  rung 2, E[Y|do(X=1)] - E[Y|do(X=0)]: 1.5000 (exact 1.5000)
  seeing X near 1: E[Y | X~1] = 2.0911 (exact 2.0854);  doing X = 1: E[Y|do(X=1)] = 1.5018 (exact 1.5000)
  rung 3, unit with X=1, Y=3: background term 1.2U+N_Y = 1.50; Y had X been 0 = 1.50

Part B. Two binary SCMs that agree on rungs 1 and 2 but not on rung 3
  M1: X := U_X, Y := X xor U_Y      M2: X := U_X, Y := U_Y   (U_X, U_Y ~ Bernoulli(0.5))
  M1: P(X,Y) cells = [0.25, 0.25, 0.25, 0.25], P(Y=1|X=1) = 0.50, P(Y=1|do(X=0)) = 0.50, P(Y=1|do(X=1)) = 0.50, P(Y_(X=0)=1 | X=1,Y=1) = 0.00
  M2: P(X,Y) cells = [0.25, 0.25, 0.25, 0.25], P(Y=1|X=1) = 0.50, P(Y=1|do(X=0)) = 0.50, P(Y=1|do(X=1)) = 0.50, P(Y_(X=0)=1 | X=1,Y=1) = 1.00

Rung 1, seeing. The regression slope of YY on XX is 2.0867 in 500,000 samples. The exact value follows by hand. Var(X)=0.82+1=1.64\mathrm{Var}(X)=0.8^2+1=1.64. Cov(X,Y)=1.5×1.64+1.2×0.8=2.46+0.96=3.42\mathrm{Cov}(X,Y)=1.5\times1.64+1.2\times0.8=2.46+0.96=3.42. The slope is 3.42/1.64=2.08543.42/1.64=2.0854. Averaging YY over samples with XX within 0.05 of 1 gives 2.0911, close to the same 2.0854. The extra 2.0854−1.5=0.58542.0854-1.5=0.5854 is not an effect of XX. It is there because a high XX hints at a high UU, and UU also raises YY.

Rung 2, doing. The function y_under_do builds the modified model: XX‘s equation is replaced by a constant, and the rest is kept. The difference between setting X=1X=1 and X=0X=0 is printed as 1.5000. This is exact, not a lucky estimate. Both settings reuse the same noise draws for UU and NYN_Y, so each simulated unit’s difference is exactly 1.5. The level E[Y∣do(X=1)]E[Y\mid do(X=1)] is 1.5018. It differs from the exact 1.5 only through the sample mean of 1.2U+NY1.2U+N_Y. So seeing X≈1X\approx1 predicts Y≈2.09Y\approx2.09, while doing X=1X=1 gives Y≈1.50Y\approx1.50.

Rung 3, imagining. One unit is seen with X=1X=1 and Y=3Y=3. Step one: its background term is 1.2U+NY=3−1.5×1=1.501.2U+N_Y=3-1.5\times1=1.50. Step two: replace XX‘s equation by X=0X=0. Step three: solve, keeping that background term: Y=1.5×0+1.50=1.50Y=1.5\times0+1.50=1.50. The population answer to “set X=0X=0” is E[Y∣do(X=0)]=0E[Y\mid do(X=0)]=0. This unit’s counterfactual is 1.50, because its background happened to be high. We cannot recover UU and NYN_Y separately from (X,Y)(X,Y), but the answer needs only their sum, as in Pearl’s linear example.

Part B, why rung 3 needs more. The two binary models print identical observational numbers: all four P(X,Y)P(X,Y) cells are 0.25, and P(Y=1∣X=1)=0.50P(Y=1\mid X=1)=0.50. They also print identical interventional numbers: P(Y=1∣do(X=0))=P(Y=1∣do(X=1))=0.50P(Y=1\mid do(X=0))=P(Y=1\mid do(X=1))=0.50. No passive data and no randomized experiment on XX and YY can tell them apart. Yet they disagree on the counterfactual.

QuantityM1: Y:=X⊕UYY := X \oplus U_YM2: Y:=UYY := U_Y
P(X,Y)P(X,Y) cells0.25 each0.25 each
P(Y=1∣X=1)P(Y=1\mid X=1)0.500.50
P(Y=1∣do(X=0))P(Y=1\mid do(X=0)), P(Y=1∣do(X=1))P(Y=1\mid do(X=1))0.50, 0.500.50, 0.50
P(YX=0=1∣X=1,Y=1)P(Y_{X=0}=1\mid X=1,Y=1)0.001.00

The hand reasoning is short. In M1, seeing X=1X=1 and Y=1Y=1 means UY=0U_Y=0; setting X=0X=0 then gives Y=0⊕0=0Y=0\oplus0=0. In M2, seeing Y=1Y=1 means UY=1U_Y=1, and YY ignores XX, so it stays 1. In words, M1 says XX flips YY for every single unit, yet the average effect is zero because the flips go both ways equally often. M2 says XX does nothing to anyone. This is the concrete meaning of “rung three needs more than rung two”. The Judea Pearl article has models that already differ at rung two; here even rung two is identical.

What the equations cannot do for you

This section lists what an SCM assumes, what it cannot check, and where this article’s example stops.

The equations are assumptions. Each missing argument or missing arrow is a claim. Pearl notes that each one alone cannot be tested, although together they can have testable consequences. In the chain Z→X→YZ\to X\to Y the model encodes seven such assumptions and implies that ZZ and YY are independent given XX. p. 106 Checking such implications is covered in causal graphs.

Counterfactual answers rest on the function form. Part B shows that observational and experimental data can leave a counterfactual completely open. The answer then comes from the chosen functions, not from data. In nonlinear models even a known observed distribution does not pin down attribution. p. 121

Hidden variables break easy identification. “Every causal effect is identifiable in a Markovian model” assumes that all model variables are observed. Part A has a hidden UU, and that is exactly why the regression slope is wrong there. When effects can still be computed from data with hidden variables is the subject of confounding, back-door adjustment and front-door adjustment.

Independence of the noise is a modelling choice. Pearl usually assumes mutually independent errors. Hernán and Robins point out that this adds independence assumptions beyond those of Robins’ FFRCISTG model. Technical Point 6.3, p. 78 Whether those extra assumptions are reasonable depends on the application.

SCMs are a simplification. Schölkopf and co-authors call physical models written as differential equations the gold standard of modelling. They place causal models between such physical models and purely statistical ones: causal models abstract away from physical detail but can still answer some interventional and counterfactual questions. Section II and Table I, pp. 2–3 So a model without time or feedback may miss how a system actually evolves.

The ICM principle is a postulate. It suggests which parts of a model should transfer across settings. It is not a guarantee that they will.

The example is a toy. Both parts are constructed models chosen to make one point each. They say nothing about any real system.

Exercises

These exercises cover the meaning of :=:=, two hand calculations, a counterexample, the truncated factorization and a transfer question.

  1. Why does Pearl insist on reading a structural equation as an assignment rather than an ordinary equality?

    Answer: An equality is symmetric. The line y=βx+uYy=\beta x+u_Y is equivalent to x=(y−uY)/βx=(y-u_Y)/\beta, which would wrongly suggest that YY drives XX. The structural reading says Nature assigns YY from XX and UYU_Y. So setting XX changes YY, while setting YY (replacing its own equation) leaves XX unchanged. pp. 103–104

  2. In Part A, derive the regression slope of YY on XX and the effect of setting XX. Where does the difference come from?

    Answer: Var(X)=0.64+1=1.64\mathrm{Var}(X)=0.64+1=1.64 and Cov(X,Y)=1.5×1.64+1.2×0.8=3.42\mathrm{Cov}(X,Y)=1.5\times1.64+1.2\times0.8=3.42, so the slope is 3.42/1.64=2.08543.42/1.64=2.0854 (simulated 2.0867). Under do(X=x)do(X=x), Y=1.5x+1.2U+NYY=1.5x+1.2U+N_Y, and UU no longer depends on XX. So E[Y∣do(X=x)]=1.5xE[Y\mid do(X=x)]=1.5x, an effect of 1.5 per unit. The gap of 0.5854 comes from UU, which raises both XX and YY.

  3. Same model. A unit is seen with X=2X=2 and Y=2Y=2. What would YY have been had XX been 1?

    Answer: Its background term is 1.2U+NY=2−1.5×2=−11.2U+N_Y=2-1.5\times2=-1. With X=1X=1: Y=1.5×1−1=0.5Y=1.5\times1-1=0.5.

  4. Claim: “If I know P(y∣do(x))P(y\mid do(x)) for every xx, I can answer any question about the effect of XX on YY.” Give a counterexample.

    Answer: Part B. M1 and M2 share every observational and interventional number, all 0.25 cells and 0.50 probabilities. They still give 0.00 and 1.00 for P(YX=0=1∣X=1,Y=1)P(Y_{X=0}=1\mid X=1,Y=1). Questions about individual units and attribution need the structural functions. p. 121 Section III-D, p. 6

  5. A Markovian model has arrows Z→XZ\to X, X→YX\to Y and Z→YZ\to Y, with all three variables observed. Its mechanisms are P(z)P(z), P(x∣z)P(x\mid z) and P(y∣x,z)P(y\mid x,z). Write P(y∣do(x))P(y\mid do(x)) using the truncated factorization.

    Answer: Drop the factor for XX: P(z,y∣do(x))=P(z) P(y∣x,z)P(z,y\mid do(x))=P(z)\,P(y\mid x,z). Summing over zz gives P(y∣do(x))=∑zP(z) P(y∣x,z)P(y\mid do(x))=\sum_z P(z)\,P(y\mid x,z). That this matches an adjustment formula is studied in back-door adjustment. Here it follows directly because the model is Markovian and fully observed.

  6. A team trains a classifier at hospital A and deploys it at hospital B, where the mix of underlying conditions differs. Under the ICM principle, which part of a causal factorization is more likely to carry over?

    Answer: The mechanism P(effect∣cause)P(\text{effect}\mid\text{cause}), like P(temperature∣altitude)P(\text{temperature}\mid\text{altitude}) in Schölkopf and co-authors’ example. The distribution of the cause, and a conditional that runs from effect to cause, are less likely to carry over. Section IV, pp. 6–7 This is a principle that guides a hypothesis, not a guarantee; check it on data from the new site. Related practice is in domain adaptation.

History and further reading

This section places SCMs in their history, as reported by the sources we read, and suggests what to read next.

Pearl presents the structural causal model as a merger of three lines of work: structural equation models from economics and the social sciences, the Neyman–Rubin potential-outcome framework, and graphical models. Section 3, p. 102 In the 2018 report he lists its parts as graphical models, structural equations, and counterfactual and interventional logic. p. 3 The report also states that every structural model determines the truth value of every counterfactual sentence. Tool 3, p. 4 Wright’s 1921 path analysis, Simon’s and Koopmans’ autonomy, and Robins’ G-computation enter this account through Pearl’s citations; we did not read those original works.

Hernán and Robins define their causal diagrams through nonparametric structural equation models (NPSEM), which go back to Robins’ 1986 work as they report it. Technical Point 6.2, p. 77 Reading their Technical Points 6.2–6.3 next to Pearl’s Section 4 shows where the two traditions agree and where their assumptions differ.

In machine learning, Schölkopf and co-authors start from the argument that generalizing well beyond the training conditions needs an underlying causal model, not only statistical associations. Section I, p. 1 They name the discovery of high-level causal variables from low-level observations causal representation learning. Abstract It connects to representation learning and disentanglement.

Suggested reading order: Pearl’s 2009 overview, Sections 3.1–3.4, for the definitions used here. Then the six-page 2018 report for the ladder. Then Schölkopf and co-authors, Sections II–IV, for the machine-learning view. Rules for turning do-expressions into ordinary probabilities are the subject of do-calculus. Deeper counterfactual reasoning is in counterfactuals, and learning the graph from data is in causal-discovery.

Make a prediction, then check

Model M1: Y := X xor U_Y; model M2: Y := U_Y (X and U_Y independent Bernoulli(0.5)). They share all observational and interventional distributions. For 'given X=1 and Y=1, would Y have been 1 had X been 0?', which is correct?

Choose one answer

Learning objectives

  • Write a structural causal model (one structural assignment per variable plus independent background variables), compute a do-intervention by replacing an equation, and explain why with a hidden common cause the structural coefficient 1.5 differs from the regression slope 2.085.
  • Compute a unit-level counterfactual by inferring the unit's background term, setting X and solving, and use two models that agree on association and intervention but not on counterfactuals to explain why the third rung needs the functional form.

Prerequisites & connections

Explore related knowledge →

References

  1. Causal inference in statistics: An overview
    Judea Pearl · 2009
  2. The Seven Tools of Causal Inference with Reflections on Machine Learning (author's version, R-481) — scoped
    Judea Pearl · 2018
  3. Towards Causal Representation Learning (arXiv v1) — scoped
    Bernhard Schölkopf; Francesco Locatello; Stefan Bauer; Nan Rosemary Ke; Nal Kalchbrenner; Anirudh Goyal; Yoshua Bengio · 2021
  4. Causal Inference: What If (online version of 19 August 2026) — scoped
    Miguel A. Hernán; James M. Robins · 2026

Version1 · Editorial status: Recorded technical checks completed

View technical check record (AI)

Claude · 2026-12-03 · Independent AI check (Claude subagent, not the author; not a human or expert review). Gemini-app style edits logged in gemini-edits-016a.json (three en and four zh edits to the opening section) were applied before this check; research was done by a separate research subagent (facts.md) and the prose by a writer subagent. I ran example.py with the pinned interpreter (numpy 1.26.4) and diffed the output against example.stdout.txt (identical); the python block and the printed output in en.mdx and zh.mdx are byte-identical to example.py and example.stdout.txt, and every quoted number matches (slope 2.0867 vs exact 2.0854, E[Y|X~1] 2.0911, do-effect 1.5000, E[Y|do(X=1)] 1.5018, background term and counterfactual 1.50, Part B cells 0.25, probabilities 0.50, counterfactuals 0.00 and 1.00). I re-derived Var(X)=1.64, Cov(X,Y)=3.42, slope 3.42/1.64=2.0854, the 0.5854 gap, the do-effect, both counterfactuals of Part B by enumeration and the exercise answers (0.5 and the truncated-factorization sum). I re-downloaded and read Pearl 2009 (R-350) pp. 102-112, 119-122, 127-128 and 131-132; Pearl R-481 in full; Schölkopf et al. arXiv:2102.11107v1 pp. 1-7 (abstract, §I, §II with Table I and footnotes 1-2, §III-B to §III-D, §IV opening with the altitude example on p. 6 and the ICM principle box on p. 7); and Hernán and Robins, What If (19 Aug 2026 PDF), Technical Points 6.2-6.3 pp. 77-78. I confirmed Pearl's p. 121 typo (u_X for u_Y) and the eq. (10) typo are not reproduced, that the ladder table is cited to R-481 Fig. 1 with the example-question column labelled ours, that 'rung i needs rung i or higher' is called informal, that the do-effect is explained as exact because both arms reuse the same noise draws, and that the pearl.mdx two-model example (which already differs at the interventional level) is linked rather than repeated. I compared zh and en section by section (same claims, hedges, numbers, equations, tables, exercises and answers), checked that every link targets a published article and that unpublished topics stay as inline code, compiled both files with scripts/check-draft-mdx.mjs and ran scripts/check-draft-prose.mjs (passed), and checked aliases case-insensitively against src/data/aliases.json and the other batch-016 folders. I did not read Pearl's Causality, the formal causal hierarchy theorem, Wright 1921, Simon/Koopmans, Spirtes et al., Robins 1986/1987, or any part of the sources beyond the pages listed.

  • Ran example.py with the pinned interpreter (numpy 1.26.4); output identical to example.stdout.txt; code and output blocks byte-identical in both languages; every quoted number matches.
  • Re-derived the slope 2.0854, the 0.5854 gap, the do-effect 1.5 (exactly 1.5000 because both arms reuse the noise draws), the unit counterfactual 1.50, the Part B values 0.00 vs 1.00, all exercise answers and the quiz answer.
  • Re-read Pearl 2009 pp. 102–112, 119–122, 127–128, 131–132: the p. 121 u_X typo and the eq. (10) typo are not reproduced; the Markovian identifiability claim matches p. 110, now with Pearl's contrast to non-Markovian models.
  • Re-read R-481 in full: the ladder table cites Fig. 1 with the example-question column labelled ours; 'rung i needs rung i or higher' is labelled informal.
  • Re-read Schölkopf et al. pp. 1–7: the ICM principle box is printed on p. 7 and the locator was corrected; the 'simpler description' claim now follows Table I; the causal-representation-learning definition is now cited to the abstract.
  • Re-read What If Technical Points 6.2–6.3: NPSEM-IE makes many more independence assumptions than FFRCISTG; removed the unsupported 'not a consensus' sentence.
  • Section-by-section zh/en comparison: claims, hedges, equations, tables, exercises and answers match; links point only to published articles and unpublished topics stay inline code; MDX compile and prose scan pass; aliases are case-insensitively unique.

Source locations checked:

  • Causal inference in statistics: An overview · R-350 pdftotext, journal pages. Read: §2.4 p. 101 (footnote 4); §3 pp. 102–103; §3.1 pp. 103–106 (Wright 1921, eqs. 1–4, exogenous/endogenous, background factors vs regression residuals, missing links, Fig. 2, seven assumptions, d-separation definition); §3.2 p. 107 (eq. 5, autonomy, Simon 1953 / Koopmans 1953); §3.2.1 pp. 107–108 (eqs. 6–9); Definition 2 p. 109; §3.2.2 pp. 109–110 (eqs. 11–14, beta proven to be an effect coefficient); §3.2.3 pp. 110–112 (Markovian; Theorem 1 eq. 15; eq. 16; Corollary 1 eq. 17; footnote 8; eqs. 18–22); §3.4 pp. 119–122 (Definition 4 eq. 27, eq. 28, linear counterfactual example — printed 'y = beta x + u_X' should read u_Y; footnotes 11–14); §4.1 pp. 127–128 (eqs. 36–38); §4.3 pp. 131–132 (eqs. 41–45). NOT read for this topic: §3.3 beyond its first page, §3.5, §5, §6.
  • The Seven Tools of Causal Inference with Reflections on Machine Learning (author's version, R-481) — scoped · pdftotext, all 6 pages read. Used: pp. 1–2 hierarchy (association P(y|x), intervention P(y|do(x),z), counterfactual P(y_x|x',y'); level i needs level ≥ i; counterfactuals need functional/structural models), Fig. 1; p. 3 SCM parts; p. 4 Tool 3 (every structural model determines the truth value of every counterfactual sentence). Published CACM version not read; the formal causal hierarchy theorem was not read.
  • Towards Causal Representation Learning (arXiv v1) — scoped · pdftotext of arXiv v1. Used: abstract p. 1 (definition of causal representation learning); §I pp. 1–2 (Issue 1 argument that out-of-i.i.d. generalization needs an underlying causal model; 'A causality perspective' p. 2); §II pp. 2–3 (differential equations, footnote 1; Table I; §II-C and footnote 2 on the intervention–counterfactual continuum); §III-C pp. 5–6 (SCM eq. 3, jointly independent noises, causal sufficiency, causal factorization eq. 4, latent confounders, hard/soft/uncertain interventions); §III-D p. 6 (only SCMs give counterfactuals; many SCMs per conditional); §IV opening and altitude–temperature example p. 6; the ICM principle box itself is printed on p. 7 (checker's correction of the page). NOT read: rest of §IV, §§V–VIII.
  • Causal Inference: What If (online version of 19 August 2026) — scoped · pdftotext, printed pages. Read for this topic only Technical Points 6.2–6.3 pp. 77–78 (NPSEM / FCISTG of Robins 1986; NPSEM-IE vs FFRCISTG; causal Markov assumption follows from Robins' independence assumption). NOT read: everything else for this topic.

Related topics

No matches. Try a synonym or acronym.

0 results shown

Wrap the whole query in double quotes for a phrase match.