Skip to content
Tutorials Center
My learning

Topics

Lesson 8 of 37 ยท Causality and Confounding

Selection Bias and Collider Bias

Learn how conditioning on a collider or selecting a sample on an outcome creates fake associations: the 'talent vs looks' example, survivorship and berkson bias, simulated in Python.

Confounding creates false associations when you ignore a common cause. Collider bias, a major kind of selection bias, does the reverse: it creates false associations when you condition on (or select by) a common effect. Adjusting for the wrong variable can make a correct analysis wrong.

What is a collider?

A collider is a variable with two arrows pointing into it:

flowchart LR
  A["Talent"] --> C["Famous"]
  B["Looks"] --> C

Fame is caused by both talent and looks. Talent and looks are independent in the general population.

In the whole population, a path through a collider is blocked: the two causes are unrelated. But once you condition on the collider (look only at famous people, or include "famous" in a regression) the path opens and the causes become associated.

Simulation: talent and looks

Python Independent traits become negatively correlated

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Among the famous, someone with little talent must have made up for it with looks, so the correlation turns strongly negative even though the traits are unrelated in everyone.

Selection on the outcome or on a consequence

Collider bias often appears as selection: your sample includes only units that passed some filter influenced by the variables you study.

  • Survivorship bias: studying only firms that survived hides all that failed.
  • Berkson's bias: a hospital sample, where people are admitted if they have disease A or disease B, makes A and B look negatively related.
  • Admission and hiring: among admitted students, test score and extracurricular strength can look negatively related.
  • Healthy-worker effect: employed people are healthier than the general population.

When it contaminates a treatment effect

Suppose a training course (T) truly has no effect on salary (Y), but both training and salary influence who gets promoted (P). If you restrict the analysis to promoted employees, you will find a bogus relationship.

Python Selecting on a collider creates a false effect

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

In the full group the difference is near zero. Among the promoted, trained people need less salary to clear the bar, so they look lower paid: a spurious negative effect.

Collider bias through regression "controls"

You do not need to filter rows. Putting a collider into a regression as a control does the same thing.

Python Controlling for a collider

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

The honest model finds about 0. Adding the collider "control" produces a clear negative slope. More controls are not always better.

How to avoid it

  1. Draw the graph and mark every variable that has two or more arrows pointing into it.
  2. Do not condition on colliders or on their descendants (a variable influenced by the collider also opens the path partially).
  3. Ask how your sample was built. If inclusion depends on the outcome or on something caused by the variables of interest, expect bias.
  4. Use designs that avoid selection (random sampling, intention-to-treat, include dropouts) or model the selection with weights.

The rule "control for everything you can measure" is wrong. It protects against confounders but invites collider bias. Which variables to adjust for is decided by the graph, as you will see in the backdoor criterion.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. A collider is a variable that:

    Two arrows point into a collider.
  2. 2. Among hospital patients admitted for disease A or disease B, A and B often look negatively associated. This is an example of:

    Admission is a collider caused by both diseases, and the sample is conditioned on it.
  3. 3. In the simulations, conditioning on the collider changed the estimate for x from 0 to:

    Holding c fixed means that when x is high, y must be low.
  4. 4. Which habit is NOT recommended?

    Blindly adding controls can condition on colliders.

Summary

  • A collider has two arrows pointing into it; conditioning on it opens a spurious path.
  • Selecting a sample by an outcome or consequence (survivorship, admission, hospital data) conditions on a collider.
  • Regression controls can cause the same problem.
  • Use the causal graph to decide what to adjust for, not the number of variables available.

Next: Stratification and Standardization