Structural Causal Model (SCM)
A structural causal model describes a system as a set of equations, one per variable, each giving the variable's value from its direct causes and from factors outside the model. Its equations define a causal diagram and show what happens when a variable is set from outside.
By Joris van Huët, Founder & CEOUpdated 7 min read
What is Structural Causal Model (SCM)?
A structural causal model describes a system with one equation per variable. The variable on the left is the effect, the variables on the right are its direct causes, and each equation stands for a mechanism that sets the effect's value from its inputs. Pearl defines the model as a triple: exogenous variables, which are set outside the model; endogenous variables, which are set within it; and structural equations that give each endogenous variable as a function of the others. Many presentations add an error term to each equation, standing for the causes that are not in the model.
Drawing an arrow from each variable to every variable whose equation contains it gives a causal diagram. The diagram carries less information than the equations: it shows which variables depend on which, not the form of the dependence. Everything absent from it is an assumption: a missing arrow says one variable has no direct effect on another, and a missing variable says it plays no part in the process.
What makes the model causal is that it says what happens when a variable is set from outside. An intervention replaces that variable's equation with a fixed value and leaves the other equations unchanged, so the effect of changing spend is read from the modified model, not from correlations in the data. Counterfactuals use the same machinery: first update the probabilities using what was observed, then perform the intervention.
The Stanford Encyclopedia of Philosophy traces causal modeling to the 1920s, especially Sewall Wright's work of 1921, and says Judea Pearl's 2000 book gave the structural equations framework its most advanced formulation. The arrows are assumptions, not findings. Pearl writes that, short of experimental control, causal assumptions cannot be confirmed even in principle, and that only a tiny fraction of the assumptions needed to identify an effect can be tested statistically.
For illustration, suppose a store's weekly model is spend = 50 + 50 x season and revenue = 2 x spend + 150 x season, with season equal to 1 in a peak week and 0 otherwise. An off-peak week has spend 50 and revenue 100, and a peak week has spend 100 and revenue 350, so a line through the two weeks has slope (350 - 100) / (100 - 50) = 5. The revenue equation says otherwise: setting spend to 100 in an off-peak week replaces the spend equation and gives revenue 2 x 100 + 150 x 0 = 200, which is 100 more than at spend 50, so each extra unit of spend adds 2, not 5.
Why Structural Causal Model (SCM) matters for ecommerce
A claim about what a channel caused cannot be computed from observational Shopify or ad-platform data alone. Pearl counts a relationship as causal when the distribution of the observed variables alone cannot define it, so every such claim leans on assumptions about what sets spend and what sets revenue. A structural causal model puts those assumptions on the page: which variables exist, which cause which, and which are not measured. With the diagram written down, the back-door criterion shows what has to be adjusted for, and a disagreement about one arrow can be argued directly. The model does not supply the answer, and the data cannot confirm most of what it assumes.
How to use Structural Causal Model (SCM)
- State the question as an intervention: what would weekly Shopify revenue be if spend on this channel were set to a given level?
- List every variable that could set revenue or spend, measured or not, such as promotions, price changes, email sends, season and stock-outs. Mark which ones you actually have in Shopify or your analytics.
- Write one line per variable saying what sets it. For example, revenue is set by spend, promotions, season and other causes, and spend is set by the budget rule, which looks at season and last week's revenue. Ask whoever sets the budget how it is really decided: that is the equation for spend.
- Draw an arrow from each cause to each variable it sets. If revenue feeds back into later spend, draw the arrow from last week's revenue to this week's spend, because these models are acyclic.
- Look for back-door paths from spend to revenue, meaning paths that start with an arrow into spend, such as season causing both. Close each one by adjusting for a measured variable or by randomizing spend. An unmeasured one is a gap the diagram has made visible.
- Judge the model. Pass: you can defend every arrow and every absent arrow from how the business works, whoever sets the budgets agrees with the diagram, and any estimate is reported as the effect if this diagram is right. Fail: an arrow is absent only because the variable is not in your data, or nobody can say how spend is set. Then the model cannot support an estimate yet, and a holdout is the better test.
Formula
X_i = f_i(PA_i, U_i) Where: - X_i: variable i in the model, such as weekly revenue - PA_i: the direct causes (parents) of X_i, such as spend and season - U_i: an error term standing for the causes of X_i that are not in the model - f_i: the mechanism, the rule that turns the inputs into the value of X_i An intervention that sets X_k to the value x_k replaces its equation with X_k = x_k and leaves every other equation unchanged.
Common mistakes
- Treating the diagram as a result. It is a set of assumptions: Pearl writes that, short of experimental control, causal assumptions cannot be confirmed even in principle, and that only a tiny fraction of the assumptions needed to identify an effect can be tested statistically. A tidy diagram is not evidence.
- Leaving a variable out because it is not in the dataset. The Effect says every non-trivial variable relevant to the process belongs in the diagram, even one you cannot measure. Dropping an unmeasured cause of both spend and revenue builds a confounder into the estimate.
- Reading a structural equation as a regression. A regression coefficient describes association in the data, while a structural equation says what the variable would be if its inputs were set. Pearl lists regression and correlation among associational concepts, and effect and structural coefficients among causal ones.
- Drawing a loop for feedback. The Stanford Encyclopedia's treatment assumes acyclic models, so revenue that changes later spend is drawn as an arrow from an earlier week to a later week, not as a loop between the two.
- Expecting the diagram to supply the shape of the effect. The Stanford Encyclopedia notes that the diagram says nothing about the functional form of the dependence, so it can say what to adjust for but not whether returns to spend are linear, saturating or lagged.
Frequently asked questions
What is a structural causal model in simple terms?
It is a set of equations, one per variable, saying how each variable gets its value from its direct causes and from factors outside the model. Drawing the arrows gives a causal diagram, and replacing one equation with a fixed value shows what happens when that variable is set from outside.How is a structural causal model different from a causal diagram?
The diagram records which variables depend on which. The model adds the equations, so it also states how they depend. The Stanford Encyclopedia of Philosophy notes that the diagram contains less information than the equations and says nothing about the form of the dependence.Can a structural causal model be tested with data?
Only a small part of it. Pearl writes that, short of experimental control, causal assumptions cannot be confirmed even in principle, and that only a tiny fraction of the assumptions needed to identify an effect can be tested statistically. The rest depends on scientific judgment about how the system works.What does the do operator do in a structural causal model?
It models an intervention: the equation for the chosen variable is deleted and replaced with a fixed value, and every other equation stays as it is. The modified model then shows what would happen if the variable were set from outside, which a table of correlations cannot show by itself.
Further reading
- Causal Models · Stanford Encyclopedia of Philosophy
- An Introduction to Causal Inference · International Journal of Biostatistics
- The Effect, Chapter 6: Causal Diagrams · Huntington-Klein
- Causal Inference: The Remix, Chapter 3: Directed Acyclic Graphs · Cunningham
- Counterfactual Theories of Causation · Stanford Encyclopedia of Philosophy