liveBook · Manning

Confounder

As explained in Causal Inference for Data Science

Confounding is a causal-analysis problem in which variables create a noncausal association that makes it difficult to distinguish a treatment's effect from other influences on the outcome.

A confounder is a variable that affects both a treatment or decision and the outcome of interest. It can create an association that makes a simple comparison misleading: the observed difference may reflect the treatment, the confounder, or both. section 1.4.2 section 2.0

Medication and age

Suppose a new medication is given more often to older patients, while age also affects recovery. Age is then a confounder: comparing recovery averages between medications cannot isolate the medication’s effect because the treatment groups differ in age. section 1.4.2

Confounding is especially important with observational data, where treatment assignment is not controlled. A positive correlation does not establish a positive causal effect: Simpson’s paradox can even reverse the apparent direction when cases differ in severity, such as kidney-stone size. section 2.0 section 2.1.2

A practical causal analysis handles confounders by:

  • Listing variables that may have shaped the data, including known, unobserved, and uncertain factors; consult domain experts to avoid omitting relevant confounders. section 3.2 section 3.2.1
  • Drawing a directed acyclic graph that states the assumed causal relationships among treatment, outcome, and other variables. section 1.1.3 section 3.6
  • Conditioning on measured confounders so their values are held fixed, then combining the relevant comparisons with the adjustment formula. section 2.1.2 section 1.1.5
  • Checking positivity: each confounder profile needs data for the treatments being compared. Many confounders make this requirement increasingly demanding. section 2.5.5 section 2.9

Randomized controlled trials and A/B tests avoid confounding through random treatment assignment when feasible. Otherwise, make explicit which confounders are measured and which are missing; unobserved confounding can make a causal analysis infeasible or require another approach. section 1.8 section 3.2.1

Discounts and purchase frequency

If frequent customers receive larger discounts and also tend to purchase more, historical purchase frequency confounds the estimated effect of discount on purchasing. Randomly giving different discount levels across frequency groups helps preserve positivity. section 3.3.2

A confounder is a shared cause affecting both the treatment and the outcome. When a confounder is present, it prevents us from accurately measuring the treatment’s effect by comparing averages.
sidebar figure

Use the graph to distinguish the treatment-to-outcome path from a shared cause that affects both variables and biases a comparison of averages. section 2.0

How Causal Inference for Data Science covers it

How deep it goes
Defines confounders, diagrams their bias, and develops conditioning and adjustment through Simpson’s paradox.
Examples
Uses medication and age, kidney-stone size, app engagement, pricing discounts, and recommender systems.
What it assumes
Introduces the definition from zero while relying on domain knowledge to identify relevant variables.
What you can do after
Evaluate/understand when naive treatment comparisons are biased and when adjustment or randomization is needed.
How it connects
Connects to causal DAGs, adjustment formula, Simpson’s paradox, positivity, average treatment effect, and randomized controlled trials.

Also explained in

Compare how 5 books explain confounder →

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.