Draw your assumptions
Use causal diagrams to decide what to adjust for, and see how adjusting for the wrong thing creates bias.
What runs in CodeSplash
- Matching (nearest neighbor, exact, coarsened exact) Verified in Python and R
- Inverse-probability and entropy-balancing weights Verified in Python and R
You will be able to
- Identify confounders, mediators and colliders in a diagram
- Find an adjustment set that blocks backdoor paths
- Explain how adjusting for a collider creates a false association
Read first
Arrows are assumptions
ReadA causal diagramCausal diagramA drawing of assumed causes as arrows; it tells you which variables to adjust for. draws what you believe causes what. Each arrow is a claim. Each missing arrow is a stronger one: that there's no direct effect.
Three shapes do most of the work, for treatment and outcome :
- ConfounderConfounderA variable that affects both the treatment and the outcome, creating a spurious association.: . Adjust for it.
- MediatorMediatorA variable on the path from treatment to outcome; adjusting for it removes part of the effect you want.: . Don't adjust if you want the total effect.
- ColliderColliderA variable caused by both treatment and outcome; adjusting for it creates a false association.: . Don't adjust.
Predict the collider
PredictPredict first
Among the general public, talent and looks are unrelated. A casting agency only signs people with high talent or good looks. Among signed actors, what happens to the correlation between talent and looks?
Reveal
It turns negative: a signed actor who isn't talented must be good-looking. Signing is a collider, and selecting on it created an association from nothing.
Adjust and watch
ExploreDExplorable · What should you adjust for?
Does adding a variable to the model remove bias or create it?
In this graph, what will adding Z to the model do to the estimate of X's effect?
The causal graph
Add Z to the regression of Y on X (or click Z in the graph).
Click Z to adjust for it. A square means Z is in the model. A red path is an open non-causal path between X and Y.
Commit your prediction above to see the result
Make your prediction to see the result.
Switch each variable's adjustment on and off. Find a set that returns the estimate to the truth, then find one that moves it further away.
The backdoor rule
ReadA non-causal path from to that enters through an arrow is a backdoor path. To identify the effect:
- Block every backdoor path by adjusting for a variable on it.
- Don't adjust for anything caused by the treatment.
- Don't open a closed path by adjusting for a collider.
In the studio's DAG step, you draw the graph and it lists the sets that satisfy this rule, along with what the graph implies you could test in the data.
Check your understanding
CheckpointCheck yourself
You study whether a training course raises pay. Promotion happens after the course and affects pay. Should you adjust for promotion?
Show the answer
Answer: b
Promotion lies on the path from the course to pay. Adjusting would answer a narrower question about the effect not via promotion.
Check yourself
You study hospital patients only. Both the disease and the risk factor make hospital admission more likely. What's the danger?
Show the answer
Answer: a
Restricting to admitted patients conditions on a collider. It's known as Berkson's bias, and it's a form of selection bias.
Check yourself
Can the data confirm your DAG?
Show the answer
Answer: b
Testable implications are worth checking. They can reject a graph, but passing them doesn't prove it. The rest is subject-matter knowledge.
Draw one
In the appIn the Causal studio, open the DAG step. Treatment and outcome are already on the canvas. Add the variables you believe matter, connect them, and read the adjustment sets it finds.
Method guide · causal.weightingInverse-probability and entropy-balancing weightsWhat is the average effect of a treatment once the groups are reweighted to have the same covariates?Recap
Recap- A DAG makes your causal assumptions explicit, and each arrow is a claim.
- Adjust for confounders; leave colliders alone, and mediators too for the total effect.
- Data can reject a graph, but can't confirm one.
Concepts in this lesson