DAGs intro with exercises D A

advertisement
DAGs intro
with exercises
3h
DirectedAcyclicGraph
Hein Stigum
http://folk.uio.no/heins/
courses
May-16
H.S.
1
Agenda
• Background
• DAG concepts
–
–
–
–
Association, Cause
Confounder, Collider, Mediator
Causal thinking
Paths
Exercises
• Analyzing DAGs
– Examples
• More on DAGs
May-16
H.S.
2
Why causal graphs?
• Estimate effect of exposure on disease
• Problem
– Association measures are biased
• Causal graphs help:
– Understanding
• Confounding, mediation, selection bias
– Analysis
• Adjust or not
– Discussion
• Precise statement of prior assumptions
May-16
H.S.
3
Causal versus casual
CONCEPTS
May-16
H.S.
4
Precision and validity
• Measures of populations
– precision - random error
– validity - systematic error
Precision
Bias
True
value
Estimate
DAGs only consider bias
5/29/2016
H.S.
5
god-DAG
Causal Graph:
Node = variable
Arrow = cause
E=exposure, D=disease
DAG=Directed Acyclic Graph
Read of the DAG:
Estimations:
Causality
= arrows
Associations = paths
Independencies = no paths
E-D association has two parts:
ED
causal effect
keep open
ECUD bias
try to close
E[C]UD Condition (adjust) to close
Time 
May-16
H.S.
6
Association
and
Cause
Association
3
possible
causal
Association
3 possible causal structures
structures
3 possible causal structure
Association
1
1
Yellow
Yellow
fingers
fingers
Lung
Lung
cancer
cancer
Cause
Cause
(Reversed cause)
E
Yellow
Yellow
fingers
fingers
Smoke
Smoke
D
Lung
Lung
cancer
cancer
2
2
Yellow
Yellow
fingers
fingers
Confounder
Confounder
Lung
Lung
cancer
cancer
U
U
3
3
Yellow
Yellow
fingers
fingers
Collider
Collider
Lung
Lung
cancer
cancer
+ more complicated structures
May-16
H.S.
7
Confounder idea
A common cause
Smoking
+
Adjust for smoking
Smoking
+
Yellow fingers
Lung cancer
+
Yellow fingers
+
Lung cancer
+
• A confounder induces an association between its effects
• Conditioning on a confounder removes the association
• Condition = (restrict, stratify, adjust)
• Paths
• Simplest form
•
Causal confounding, may have non-causal confounding
May-16
H.S.
8
Collider idea
Two causes for selection to study
Selected
+
Yellow fingers
Selected subjects
Selected
+
Lung cancer
+
+
Yellow fingers
Lung cancer
- or
+ and
• Conditioning on a collider induces an association
between its causes
• “And” and “or” selection leads to different bias
•
Paths
• Simplest form
May-16
H.S.
9
Mediator
M
• Have found a cause (E)
• How does it work?
– Mediator (M)
E
direct effect
D
– Paths
𝑇𝑜𝑡𝑎𝑙 𝑒𝑓𝑓𝑒𝑐𝑡 = 𝑖𝑛𝑑𝑖𝑟𝑒𝑐𝑡 + 𝑑𝑖𝑟𝑒𝑐𝑡
𝑖𝑛𝑑𝑖𝑟𝑒𝑐𝑡
𝑀𝑒𝑑𝑖𝑎𝑡𝑒𝑑 𝑝𝑟𝑜𝑝𝑜𝑟𝑡𝑖𝑜𝑛 =
𝑡𝑜𝑡𝑎𝑙
Use ordinary regression methods if:
linear model and
no E-M interaction.
Otherwise, need new methods
May-16
H.S.
10
Causal thinking in analyses
May-16
H.S.
11
Regression before DAGs
Use statistical criteria
for variable selection
Risk factors for D:
Variable
OR
E
2.0
C
1.2
Comments
Surprisingly low association
Association
Both can be
misleading!
C
E
May-16
Report all variables in
the model as equals
D
H.S.
12
Statistical criteria for variable selection
C
E
D
- Want the effect of E on D (E precedes D)
- Observe the two associations C-E and C-D
- Assume statistical criteria dictates adjusting for C
(likelihood ratio, Akaike (赤池 弘次) or 10% change in estimate)
The undirected graph above is compatible with three DAGs:
C
C
E
D
Confounder
1. Adjust
Conclusion:
E
C
D
Mediator
2. Direct: adjust
3. Total: not adjust
E
D
Collider
4. Not adjust
The data driven method is correct in 2 out of 4 situations
Need information from outside the data to do a proper analysis
DAGs variable selection: close all non-causal paths
May-16
H.S.
13
Association versus causation
Use statistical criteria
for variable selection
Risk factors for D:
Variable
OR
E
2.0
C
1.2
Comments
Surprisingly low association
Association
Causation
C
E
Symmetrical
C is a confounder for E-D
E is a confounder for C-D
May-16
Base adjustments
on a DAG
C
D
Report all variables in
the model as equals
E
D
Directional
Report only
the E-effect
C is a confounder for ED
E is a mediator for CD
H.S.
14
The Path of the Righteous
Paths
May-16
H.S.
15
Path definitions
Path: any trail from E to D (without repeating itself)
Type: causal, non-causal
State: open, closed
1
2
3
4
Four paths:
Path
ED
EMD
ECD
EKD
Goal:
Keep causal paths of interest open
Close all non-causal paths
May-16
H.S.
16
Four rules
1. Causal path: ED
(all arrows in the same direction) otherwise non-causal
Before conditioning:
2. Closed path: K
(closed at a collider, otherwise open)
Conditioning on:
3. a non-collider closes: [M] or [C]
4. a collider opens:
[K]
(or a descendant of a collider)
May-16
H.S.
17
ANALYZING DAGs
May-16
H.S.
18
Confounding examples
May-16
H.S.
19
Vitamin and birth defects
1. Is there a bias in the crude E-D effect?
2. Should we adjust for C?
3. What happens if age also has a direct effect on D?
Unconditional
Path
1 ED
2 ECUD
Type
Status
Causal
Open
Non-causal Open
Conditioning on C
Path
1 ED
2 EC]UD
3 EC] D
Type
Causal
Non-causal
Non-causal
May-16
May-16
Status
Open
Closed
Closed
Bias
No bias
H.S.
This is an example
of confounding
Question:
Is U a confounder?
20
Exercise: Physical activity and
Coronary Heart Disease (CHD)
We want the total effect of Physical
Activity on CHD.
1. Write down the paths.
2. Are they causal/non-causal,
open/closed?
3. What should we adjust for?
5 minutes
May-16
H.S.
21
Intermediate variables
May-16
H.S.
22
Exercise: Tea and depression
1. Write down the paths.
Show type and status.
O
coffee
E
tea
2. You want the total effect
of tea on depression. What
would you adjust for?
C
caffeine
D
depression
3. You want the direct effect
of tea on depression. What
would you adjust for?
4. Is caffeine an intermediate
variable or a confounder?
10 minutes
May-16
H.S.
23
Exercise: Statin and CHD
C
cholesterol
E
U
lifestyle
1. Write down the paths. Show
type and status.
D
2. You want the total effect of
statin on CHD. What would
you adjust for?
CHD
statin
3. If lifestyle is unmeasured, can
we estimate the direct effect of
statin on CHD (not mediated
through cholesterol)?
4. Is cholesterol an intermediate
variable or a collider?
10 minutes
May-16
H.S.
24
Direct and indirect effects
So far:
Causal interpretation:
Controlled (in)direct effect
linear model and no E-M interaction
New concept:
Natural (in)direct effect
Causal interpretation also for: non-linear model , E-M interaction
Controlled effect = Natural effect if
linear model and no E-M interaction
Hafeman and Schwartz 2009;
Lange and Hansen 2011;
Pearl 2012;
Robins and Greenland 1992;
VanderWeele 2009, 2014
May-16
H.S.
25
Confounder, collider and mediator
Mixed
May-16
H.S.
26
Diabetes and Fractures
We want the total effect of
Diabetes (type 2) on fractures
Conditional
Unconditional
Path
Path
11 E→D
E→D
22 E→F→D
E→F→D
33 E→B→D
E→B→D
44 E←[V]→B→D
E←V→B→D
55 E←[P]→B→D
E←P→B→D
May-16
Type
Type
Causal
Causal
Causal
Causal
Causal
Causal
Non-causal
Non-causal
Non-causal
Non-causal
Status
Status
Open
Open
Open
Open
Open
Open
Closed
Open
Closed
Open
H.S.
Questions:
Mediators
More paths?
B a collider?
V and P ind?
Confounders
27
Selection bias
May-16
H.S.
28
Convenience sample, homogenous sample
H
1. Convenience sample:
Conduct the study among
hospital patients?
hospital
E
D
2. Homogeneous sample:
Population data,
exclude hospital patients?
fractures
diabetes
Conditional
Unconditional
Path
1 E→D
2 E→H←D
E→[H]←D
Type
Causal
Non-causal
Non-Causal
Status
Open
Closed
Open
Collider, selection bias
Collider stratification bias: at least on stratum is biased
This type of selection bias can be adjusted for!
May-16
H.S.
29
Adjusting for Selection bias
S
sex
age
smoke
CHD
Paths
Type
Status
smokeCHD
Causal
Open
smokesexSageCHD Non-causal Open
Adjusting for sex or age or both
removes the selection bias
Selection bias types:
Berkson’s, loss to follow up, nonresponse, self-selection, healthy worker
Hernan et al, A structural approach to selection bias, Epidemiology 2004
May-16
H.S.
30
Drawing DAGs
with DAGitty
May-16
H.S.
31
Drawing a causal DAG
Start: E and D
add: [S]
add: C-s
1 exposure, 1 disease
variables conditioned by design
all common causes of 2 or more
variables in the DAG
C
V
E
D
C must be included
V may be excluded
M may be excluded
K may be excluded
common cause
exogenous
mediator
unless we condition
M
K
May-16
H.S.
32
DAGitty drawing tool
• DAGitty
– Draw DAGs
– Find adjustment sets
– Test DAGs
• Web page
– http://www.dagitty.net/
– Run or download
May-16
HS
33
Interface
May-16
HS
34
Draw model
• Draw new model
– Model>New model, Exposure, Outcome
• New variables, connect
–
–
–
–
n
c
r
d
new variable (or double click)
connect
(hit c over V1 and over V2 to connect)
rename
delete
• Status (toggle on/off)
–u
–a
May-16
unobserved
adjusted
HS
35
Export DAG
• Export to Word or PowerPoint
– “Zoom” the DAGitty drawing first (Ctrl-roll)
– Use “Snipping tool” or
– use Model>Export as PDF
Without zooming
May-16
With zooming
HS
36
Randomized experiments
May-16
H.S.
37
Strength of arrow
E
Not
deterministic
C1
D
C2
C1, C2, C3 exogenous
Adjust for C1, C2, C3?
C3
C
R
full
compliance
deterministic
E
Full compliance
 no E-D confounding
D
U
R
not full
compliance
E
D
Sub analysis conditioning on E
may lead to bias
May-16
Not full compliance
 weak E-D confounding
but R-D is unconfounded
Path
1 RED
2 REUD
H.S.
Type
Status
Causal
open
non-causal closed
38
Randomized experiments
C
E
Observational study
D
C
R
E
D
U
R c E IVe
ITTe
D
Randomized experiment with full compliance
R= randomized treatment
E= actual treatment.
R=E
Randomized experiment with less than full
compliance (c)
If linear model: ITTe=c*IVe, c<1
IntentionToTreat effect:
effect of R on D (unconfounded)
population
PerProtocol:
crude
effect of E on D (confounded by U)
InstrumentalVariable effect: adjusted effect of E on D (if c is known, 2SLS) individual
May-16
H.S.
39
Exercise: R
E
R
+
-
+
85
0
85
15
100
115
D
R
+
-
+
43
63
106
57
37
94
D
E
+
-
+
38
68
106
47
47
94
C
andomized
T
ontrolled
rial
N
Risk
1.
100
100
0.85
0.00
Calculate the compliance (c) as a
risk difference from the table.
2.
Calculate the intention to treat effect
(ITTe) as a risk difference.
N
Risk
3.
100
100
0.43
0.63
Calculate the per-protocol effect (PP)
as a risk difference.
4.
Calculate the instrumental variable
effect (IVe).
N
Risk
5.
Explain the results in words.
85
115
0.45
0.59
U
R c E
IVe
D
10 minutes
ITTe
May-16
H.S.
40
MORE ON DAGs
May-16
H.S.
41
Confounding versus selection bias
Path:
Any trail from E to D (without repeating itself)
Open non-causal path = biasing path
Confounding and selection bias not always distinct
May use DAG to give distinct definitions:
C
A
E
A B D
Causal
C
B
A
B
E
D
Confounding:
E
D
Selection bias:
Non-causal path
without colliders
Non-causal path open
due to conditioning
on a collider
Note: interaction based selection bias not included
Hernan et al, A structural approach to selection bias, Epidemiology 2004
May-16
H.S.
42
Summing up
• Data driven analyses do not work. Need (causal) information
from outside the data.
• DAGs are intuitive and accurate tools to display that
information.
• Paths show the flow of causality and of bias and guide the
analysis.
• DAGs clarify concepts like confounding and selection bias,
and show that we can adjust for both.
Better discussion based on DAGs
Draw your assumptions
before your conclusions
May-16
H.S.
43
Recommended reading
• Books
–
–
–
–
–
Hernan, M. A. and J. Robins. Causal Inference. Web:
Rothman, K. J., S. Greenland, and T. L. Lash. Modern Epidemiology, 2008.
Morgan and Winship, Counterfactuals and Causal Inference, 2009
Pearl J, Causality – Models, Reasoning and Inference, 2009
Veierød, M.B., Lydersen, S. Laake,P. Medical Statistics. 2012
• Papers
– Greenland, S., J. Pearl, and J. M. Robins. Causal diagrams for epidemiologic
research, Epidemiology 1999
– Hernandez-Diaz, S., E. F. Schisterman, and M. A. Hernan. The birth weight
"paradox" uncovered? Am J Epidemiol 2006
– Hernan, M. A., S. Hernandez-Diaz, and J. M. Robins. A structural approach to
selection bias, Epidemiology 2004
– Berk, R.A. An introduction to selection bias in sociological data, Am Soc R 1983
– Greenland, S. and B. Brumback. An overview of relations among causal modeling
methods, Int J Epidemiol 2002
– Weinberg, C. R. Can DAGs clarify effect modification? Epidemiology 2007
May-16
H.S.
44
Download