What is this about?
In data, two things are often associated, for example exercise and heart health. Why? Exercise might protect the heart. Active people might also be younger. Or the way the sample was selected plays a role. To sort this out, you draw the causes you assume as a graph with arrows (
DAG). An arrow A β B means: A influences B.
In three stages, the tool takes you from the question βWhen are two variables associated?β to the question of which variables you should take into account (adjust for) in an analysis. You need no prior knowledge of causal analysis.
The key terms
β’
Edge: a single arrow between two variables, for example A β B.
β’
Path: a sequence of one or more edges connecting two variables. A β B β C is a path made of two edges. When walking along a path, the direction of the arrows does not matter. A path is
causal only if all arrows point in the same direction (A β B β C).
β’
Information flows: If a path is open, one variable tells you something about the other. We then see an association.
β’
Adjusting (also controlling for or partialling out): You compare only people who are equal on one variable, for example only people of the same age.
β’
Confounder / fork (A β B β C): a common
cause of two variables. It creates a spurious association. Adjusting closes this unwanted path.
β’
Mediator / chain (A β B β C): an intermediate station through which a cause acts. Adjusting closes this causal path. Whether that is what you want depends on the effect you are after: for the total effect the path belongs to it, for the direct effect it does not.
β’
Collider (A β B β C): a common
effect of two variables. The path is closed at first. Adjusting opens this previously closed, unwanted path and creates an association that does not exist in the world.
β’
d-separated and d-connected: All paths between two variables are blocked (d-separated), or at least one is open (d-connected).
β’
Intervention (also called manipulation,
do-operator): You deliberately make someone do something instead of just observing.
The core message
Adjusting for a confounder β an unwanted path is closed.
Adjusting for a mediator β a causal path is closed.
Adjusting for a collider β a previously closed, unwanted path is opened.
Which of these consequences you want depends on which effect you want to estimate. So the first question is always: Which effect am I after? Then you ask: What happens to the paths between X and Y when I adjust for Z?
The three rules of do-calculus
If you want to compute the effect of an intervention from observational data, you can apply three rules. You can read them as questions to your graph:
β Ignore observations: Which additional observed variables provide any relevant information at all?
β‘ Replace intervention with observation: When may an interventional effect be inferred from observed associations?
β’ Ignore intervention: Which variables are affected by the intervention at all?
In stage 3 the tool applies these rules to your adjustment. The derivation is in the expandable section βWhy is this solution formally valid?β, after you have solved the task intuitively.
All numbers come from simulations with linear relationships. The arrows are assumptions that you can see in the graph and change.
How to proceed
β Information flow: You get to know the three patterns mediator, confounder and collider. The tool shows when an association arises between two variables and what adjusting does to it.
β‘ Reading paths: You examine larger graphs and check for each path whether it is open or blocked. The tool shows what that means for the effect.
β’ Application: Using exercise and heart health as an example, you determine the total effect (A) and the direct effect (B) in two tasks. The indirect effect follows from these. You choose yourself what to adjust for. After βCheck my solutionβ the tool shows the consequence.
What to watch out for
β’ Whether an adjustment helps depends on which paths it opens or closes and on whether the path belongs to the effect you are after.
β’ An adjustment can also do harm even though it sounds plausible. Variables that change no path have no influence on the effect.
β’ Opposing paths can cancel each other out. An open path therefore does not always show an association.
And then?
How to implement the chosen adjustment in R is shown by the
Golem Builder.