Suppose you want to know what would happen to in-game purchases if players engaged more with side quests. A causal graph can say which variables cause purchases; it does not, by itself, say how a change in engagement changes them. An assignment function supplies that rule. In a structural causal model (SCM), each endogenous variable has a function that sets its value from its causal parents. section 6.1.3 section 7.2.2
For an outcome Y with an endogenous parent X and an exogenous parent Ny, write ny ~ P(Ny) and y := fy(x, ny). Ny represents causes left unmodeled; its value is drawn from a distribution. Once x and ny are fixed, fy fixes y. Y can therefore vary across generated cases even though its assignment is deterministic for any given inputs. Unlike a causal graphical model that samples Y from a distribution conditional on its parents, an SCM places the randomness in exogenous variables. section 6.1.3 section 6.1.7 section 6.4.3
A linear assignment
For height y and femur length x, one possible rule is ny ~ N(0, δ) and y := α + βx + ny. The parameters can be fitted to data, but choosing a linear function asserts a proportional relationship between femur length and height. That causal assumption matters separately from how well the model fits observed values. section 6.4 section 6.1.5
Choose the function for the causal relationship you need to represent, not merely because it predicts well:
- For a rule-based system, write the rule directly. In a Monty Hall model, the host’s door is determined by the car’s door, the player’s first choice, and the host’s inclination; a zero-or-one conditional probability table implements that assignment with pgmpy’s TabularCPD. section 6.3.3
- For additive models, place the exogenous input alongside a function of the endogenous parents: V := g(Vpa) + Nv. Linear Gaussian models use a linear g and normally distributed noise; a nonlinear function can instead encode domain knowledge, such as an enzyme–protein relationship. section 6.4.3 section 6.4.4 section 6.4.6
- For a trainable nonlinear rule, constrain its function class to the causal behavior the inference relies on. Neural assignment functions can be fitted with normalizing flows, but flexibility alone does not encode assumptions about how causes act. section 6.5.3
An assignment function also gives an intervention a precise meaning. To model do(X=x), replace X’s assignment function with the constant x; leave the other assignment functions unchanged. X then no longer depends on its former parents. For a counterfactual, infer exogenous values compatible with what was observed, apply the hypothetical intervention, and run the remaining assignments to obtain hypothetical outcomes. section 7.2.2 section 9.1.3
Do not assume that a fitted assignment has recovered the true causal rule. Different functions can be consistent with the same graph and observed distribution, and different reparameterizations of one probabilistic model can yield different SCMs. Selecting a function class therefore requires assumptions or constraints beyond statistical fit. If an inference depends on linearity, monotonicity, or another feature of the rule, make that dependence explicit. section 6.2.1 section 6.2.2 section 6.4.1
Figure 6.13 Two different ways of reparameterizing a causal generative model yield two different SCMs. They encode the same joint probability distribution but different endogenous values given the same exogenous value.
Compare two reparameterizations that preserve the same joint distribution but assign different outcomes for the same exogenous value. section 6.2.1
