liveBook · Manning

Indirect effect

As explained in Causal Inference for Data Science

An indirect effect is the causal influence of one variable on another that operates through one or more intervening variables.

An indirect effect is the part of a causal effect that reaches an outcome through paths other than the direct arrow. If changing X changes mediator Z and Z changes Y, the X → Z → Y route contributes an indirect effect of X on Y. Causal diagrams make the distinction practical: only directed paths from X to Y transmit causal effects; a backdoor pattern such as X ← Z → Y is not a causal path from X to Y. section 6.1.2

The question determines which effect matters. A topic may affect pageviews directly through reader interest and indirectly by changing the advertising platform used. Asking for the topic’s total impact includes both routes; asking for its impact apart from the platform isolates the direct effect. Treating platform as the intervention instead poses a different causal question. section 3.2.4 section 6.1.2

For linear models, effects decompose cleanly: total effect = direct effect + indirect effect. This identity does not generally hold for nonlinear models, whose definitions require counterfactual knowledge. Do not infer an indirect effect merely from a predictive regression coefficient; identify the causal paths and the role of each variable first. section 6.1.2

Hotel distance, price, and customers

Suppose distance from town affects customers directly and also changes the hotel price. In synthetic data, distance lowers price by 3 units, while each price-unit increase lowers customers by 2. The indirect effect is therefore −2 × −3 = 6: being farther away lowers prices, and lower prices raise demand. With a direct distance effect of −10, the total effect is −4. A regression of customers on distance estimates the total effect when no confounders lie between them; controlling for price instead isolates the direct distance effect under the stated linear model. section 6.1.1 section 6.1.2

When separating effects, keep these checks in view:

  • Draw the directed paths from the proposed cause to the outcome; paths through mediators contribute to the indirect effect. section 6.1.2
  • Decide whether the existing mediator policy should remain in place. If it does, the total effect includes the mediated route; if it changes, the direct effect may be the target. section 6.1.1
  • Distinguish mediators from confounders and colliders before choosing a regression. In a three-node linear mediator graph, Y ~ X estimates total effect, while Y ~ X + Z estimates direct effect. section 6.1.2
Figure 6.1 Graph illustrating the data-generation process for creating synthetic data, as described in the example. The arrows in the graph are labeled with their corresponding linear coefficients, all of which are negative, as this fits the context of the data modeled.
figure

Use the labeled data-generation graph to trace the direct distance-to-customers arrow separately from the distance-to-price-to-customers route, then multiply coefficients along the mediated path. section 6.1.1

How Causal Inference for Data Science covers it

How deep it goes
Defines directed-path effects, gives linear formulas and regressions, and defers nonlinear definitions to counterfactual reasoning.
Examples
Uses topic-to-pageviews through advertising platform and hotel distance-to-customers through price, with synthetic R and Python data.
What it assumes
Assumes causal diagrams and variable roles while introducing direct, indirect, and total effects; defers counterfactual treatment of nonlinear models.
What you can do after
Evaluate/understand whether a causal question targets a direct, indirect, or total effect and select stated linear regressions accordingly.
How it connects
Connects direct effect, total effect, mediators, confounders, colliders, DAGs, linear regression, and counterfactuals.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Causal Inference for Data Science. The section links point to the parts of the book it draws on.