DAGs intro with exercises 6h DAGs = Directed Acyclic Graphs Hein Stigum http://folk.uio.no/heins/ courses May-16 H.S. 1 Agenda • Background • DAG concepts – Association, Cause – Confounder, Collider – Paths Exercises • Analyzing DAGs – Examples • More on DAGs May-16 H.S. 2 Why causal graphs? • 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 - statistics – validity - systematic error - epidemiology Precision Bias True value Estimate DAGs only consider bias 29.05.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: ED causal effect keep open ECUD bias try to close Conditioning (Adjusting): E[C]UD 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 Smoke Smoke Yellow Yellow fingers fingers Lung Lung cancer cancer 2 2 Yellow Yellow fingers fingers Confounder Confounder Lung Lung cancer cancer U U 3 3 Yellow Yellow fingers fingers Cause Cause 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) • Simplest form 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 • Simplest form May-16 H.S. 9 Data driven analysis C E D - Want the effect of E on D (E precedes D) - Observe the two associations C-E and C-D - Assume 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: May-16 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 H.S. 10 The Path of the Righteous Paths May-16 H.S. 11 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 ED EMD ECD EKD Goal: Keep causal paths of interest open Close all non-causal paths May-16 H.S. 12 Four rules 1. Causal path: ED (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. 13 ANALYZING DAGs May-16 H.S. 14 Confounding examples May-16 H.S. 15 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 ED 2 ECUD Type Status Causal Open Non-causal Open Conditioning on C Path Type Status 1 ED Causal Open 2 EC]UD Non-causal Closed May-16 May-16 Bias This is an example of confounding No bias H.S. 16 Exercise: Physical activity and Coronary Heart Disease (CHD) 1. We want the total effect of Physical Activity on CHD. What should we adjust for? 5 minutes May-16 H.S. 17 Direct and indirect effects Intermediate variables May-16 H.S. 18 Exercise: Tea and depression 1. Write down the paths. 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. 19 Exercise: Statin and CHD C cholesterol E U lifestyle D CHD statin 1. Write down the paths. 2. You want the total effect of statin on CHD. What would you adjust for? 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. 20 Direct and indirect effects U2 M E U3 • Total effect: – no unmeasured U1 – no unmeasured U2 + D • Direct and indirect effects – (linear model) – no unmeasured U3 U1 May-16 H.S. 21 Confounder, collider and mediator Mixed May-16 H.S. 22 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 Paths ←→? More paths? B a collider? V and P ind? Confounders 23 Selection bias May-16 H.S. 24 Selection bias: concept 1 S age smoke CHD Age Young Old All Population RRsmoke Selected RRsmoke 50 % 4.0 75 % 4.0 50 % 2.0 25 % 2.0 3.0 3.5 • Properties: Name: interaction based? - Need heterogeneity of smoke effect - Can not be adjusted for - True RR=weighted average of stratum effects May-16 H.S. 25 Selection bias: concept 2 S sex age smoke CHD Paths Type Status smokeCHD Causal Open smokesexSageCHD Non-causal Open Properties: Name: Collider stratification bias Does not need heterogeneity Can be adjusted for (sex and age) (Some counterintuitive results) Hernan et al, A structural approach to selection bias, Epidemiology 2004 May-16 H.S. 26 Diabetes and Fractures 1. Population based: Path 1 E→D 2 E→H←D Type Causal Non-causal Status Open Closed OK 2. Convenience: Conduct the study among hospital patients? 3. Homogeneous sample: Path 1 E→D 2 E→[H]←D Type Status Causal Open Non-Causal Open Exclude hospital patients Collider stratification bias: at least on stratum is biased May-16 H.S. 27 Selection examples (collider stratification) “Or”-selection: E H hospital 2.0 ← sufficient causes for hospital Population RR= 2.0 3.0 Hospital RR= 1.6 Not-hospital RR= 1.5 D E diabetes D 2.0 fractures Bias “And”-selection: E D ← sufficient causes for hospital H hospital 1.8 1.4 May-16 Hospital RR= 4.1 Not-hospital RR= 1.3 D E diabetes Population RR= 2.0 2.0 fractures H.S. 28 Exercise: Survivior bias • Study exposure early in life (E) on later disease (D) among survivors (S) • Early exposure decreases survival • A risk factor (R) increases later disease (D) and reduces survival (S) Draw and analyze the DAG 10 minutes May-16 H.S. 29 Milk intake and bone density • Study S calcium supp. E D milk bone density S C calcium supp. family history E D milk bone density Structure: Collider stratification May-16 – Milk on bone density – Exclude Calcium supplements? Path 1 ED 2 E[S]D Type Status Causal Open Non-causal Open 2 E[S][C]D Non-causal Closed Lessons learned: Biological effect not protected May adjust for selection bias H.S. 30 Examples S C respond education E D alcohol CHD S C loss to follow up smoking E D drug disease • Differential response – Survey: Alcohol and CHD • Differential loss to follow up – Randomized trial: drug and disease Note: no confounding Hernan et al, A structural approach to selection bias, Epidemiology 2004 May-16 H.S. 31 Exercise: Dust and lung disease • Background – We are interested in the effect of dust and heat exposure on lung disease, and do a cross-sectional study among workers in aluminum melt halls. • Assumptions – Workers who are sensitive to dust and heat are more likely leave melt hall work. Subjects with general good health (genes) are more likely to keep the job, and less likely to develop lung disease. • Draw and analyze the DAG – What type of bias do you get? – Could the ”interaction based” selection bias also operate here? 15 minutes May-16 H.S. 32 Information bias May-16 H.S. 33 Depicting measurement error a) • UE – E=true exposure – E*=measured exposure – UE=process giving error in E E* b) Error in E E D UE UD E* D* E D • Error in E and D – D=true disease – D*=diagnosed disease – UD=process giving error in D a) and b) Can test H0 b) shows independent non-differential errors May-16 H.S. 34 Dependent errors, differential errors a)a)a) b)b)b) c)c)c) UED UED UED UEUEUE UDUDUD UEUEUE UDUDUD UEUEUE UDUDUD E*E*E* D*D* D* E*E*E* D*D* D* E*E*E* D*D* D* EEE EEE EEE DDD Dependent errors: Temp. in lab DDD Differential error: Recall bias in Case-Control study DDD Differential error: Investigator bias in cohort study Hernan and Cole, Causal Diagrams and Measurement Bias, AJE 2009 May-16 H.S. 35 Randomized experiments Mendelian randomization May-16 H.S. 36 Strength of arrow E Not deterministic C1 D C2 C1, C2, C3 exogenous C3 C R full compliance deterministic E Randomization: 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 RED 2 REUD H.S. Type Status Causal open non-causal closed 37 Randomized experiments C Observational study E D C R E D U Rc E b Randomized experiment with full compliance R= randomized treatment E= actual treatment, R=E Randomized experiment with less than full compliance (c) D If linear model: a=c*b, c<1 a Intention To Treat (a): effect of R on D (unconfounded) population Per Protocol: crude effect of E on D (confounded by U) Instrumental Variable (b): adjusted effect of E on D (if c is known, 2SLS) individual May-16 H.S. 38 R C andomized T example ontrolled rial E R + - + 93 0 U 7 100 RD 0.93 0 57 38 RD -0.20 0 ITT 59 37 RD -0.22 0 PP -0.12 c R D R + - + 43 62 c IV E 0.09 D ITT 𝐼𝑉 = 𝐼𝑇𝑇 0.20 = − = −0.21 𝑐 0.93 D + E - + 41 63 Stata command for IV: ivregress (2SLS) True value Negative bias from confounding May-16 ITT always weaker than IV H.S. 39 Mendelian randomization • U Observational study – • Suffers from unmeasured confounding Randomized trial: 3 conditions 1. R affects E: 2. No direct R-D effect: 3. R and D no common causes: • E D U 3 balanced, strong effect R independent of D | E R 1 R independent of U D 2 Medelian randomization: 3 conditions 1. G must affect E: unbalanced, weak large N 2. No direct G-D effect: depends on gene function 3. G and D no common causes: Mendel’s 2. law E U 3 G 1 E D 2 Sheehan et al, Mendelian Randomisation and Causal Inference in Observational Epidemiology, PLoS Med 2008 May-16 May-16 H.S. H.S 40 40 Ex: Alcohol and blood pressure • U Observational study – – Alcohol use increases blood pressure Many ”lifestyle” confounders A BP Alcohol use Gene: ALDH2, 2 alleles – – alcohol ml/day • 2,2 type suffer nausea, headache after alcohol low alcohol regardless of lifestyle (U) 40 30 20 10 0 1,1 • 1,2 Genotype Medelian randomization 1. Gene ALDH2 is highly associated with alcohol 2. OK, gene function is known 3. Mendel’s 2. law, no ass. to obs. confounders – – Result: 1,1 type BP +7.4 mmHg Alcohol increases blood pressure U 3 G 1 A BP 2 Chen et al, Alcohol Intake and Blood Pressure, PLoS Med 2008 May-16 May-16 H.S. H.S 2,2 41 41 MORE ON DAGs May-16 H.S. 42 Methods of adjusting Method Action Effect C Conditioning, Stratification Close path E D C Matching in cohort Remove arrow E Matching in Case-Control May-16 C Remove arrow E InverseProbabilityWeighting ~ matching H.S. D D 43 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. 44 Exercise: M-structure A B C E D 1. Show the paths 2. Should we adjust for C? 3. If the design implies a selection on C, what would you call the resulting bias: selection bias or confounding? 5 minutes May-16 H.S. 45 Variables and arrows • Variable at least two values • cause, almost any causal definition will work • ED usually on the individual level, “at least one subject with an effect of the exposure” • ? age only possible on group level • ED the dose response can be linear, threshold, U-shaped or any other (DAGs are nonparametric) May-16 H.S. 46 Causal graphs: definitions • Causal graph – Graph showing causal relations and conditional independencies between variables – G={V,E} • Vertices=random variables • Edges=associations or cause – Edges undirected or → directed – Path • Sequence of connected edges: • Parent → child • Ancestors → descendants – Exogenous: variables with no parents May-16 H.S. L A Y U [(L,A),(A,Y)] L,U 47 D irected A G cyclic raphs • Ordinary DAG – Arrows = associations L • Causal DAG A Y U 1. Arrows = cause 2. All common causes of any pair of variables in the DAG are included • Two types of variables – Immutable – Mutable sex, age exposure (actions), smoking • Mixing variables in a DAG is OK – All dependence/independence conclusions valid May-16 H.S. 48 DAGs and probability theory • Two assumptions – Causal Markov assumption • Factorize distributions – Faithfulness assumption • No perfect cancellations of effects May-16 H.S. 49 D-separation, moralization • Directed graph-separation – two variables d-separated – otherwise d-connected if no open path • 2 DAG analyses – Paths (Pearl) – Moralization (Lauritzen) – equivalent May-16 H.S. 50 3 strategies for estimating causal effects C • Back-door criterion – Condition to close all no-causal paths E (between E and D) D U • Front-door criterion – Condition an all intermediate variables M1 M2 E (between E and D) • InstrumentalVariables – – 1. 2. 3. IV IV must affect E No direct IV-D effect IV and D no common causes U 3 Use an IV to control the effect (of E on D) IV criteria: 1 E D 2 Pearl 2009, Glymor and Greenland, 2008 May-16 May-16 H.S. H.S D 51 51 Example: front–door criterion • Weight and CoronaryHeartDisease • Assume: – adjusted for sex, age and smoke – lifestyle is unmeasured – no other mediators (between E and D) U lifestyle C E cholesterol weight B D CHD blood pressure • Can estimate effect of E on D • Weight is not a good “action” May-16 H.S. 52 DAGs and causal pies DAG Sufficient causes E1 E1 1. E1 or E2 E2 D E1 E2 2. E1 and E2 E2 E1 E2 E1 E2 3. both DAGs are less specific than causal pies DAGs are scale free, interaction is scale dependent Greenland and Brumback, Causal modeling methods, Int J Epid 2002 May-16 H.S. 53 Exercise: causal pies 1. Write down the causal pies for getting into hospital based on the DAG. Show that the DAG is compatible with at least 3 different combinations of sufficient causes. H hospital E diabetes D fractures 2. Selection bias: Discuss how the different combinations of sufficient causes for getting into hospital might affect the estimate of E on D among hospital patients (perhaps difficult). 10 minutes May-16 H.S. 54 Limitations and problems of DAGs • New tool relevance debated, focus on causality • Focus on bias precision also important • Bias or not magnitude and direction • Interaction scale dependent • Drawing capture reality, large enough to be realistic small enough to be useful VanderWeele, The sign of the bias of unmeasured confounding. Biometrics 2008 VanderWeele, Causal directed acyclic graphs and the direction of unmeasured confounding bias" Epidemiology 2008 VanderWeele, Directed acyclic graphs, sufficient causes, and the properties of conditioning on a common effect." Am J Epid 2007 May-16 H.S. 55 Drawing DAGs May-16 H.S. 56 Technical note on drawing DAGs • Drawing tools in Word (Add>Figure) • Use Dia • Use DAGitty • Hand-drawn figure. May-16 H.S. 57 Direction of arrow C Smoking ? E D Phys. Act. Diabetes 2 H C Health con. Smoking E D Phys. Act. Diabetes 2 May-16 Does physical activity reduce smoking, or does smoking reduce physical activity? Maybe an other variable (health consciousness) is causing both? H.S. 58 Time C Smoking ? E D Phys. Act. Diabetes 2 Does physical activity reduce smoking, or does smoking reduce physical activity? C Smoking -5 E D Phys. Act. -1 Diabetes 2 May-16 Smoking measured 5 years ago Physical activity measured 1 year ago H.S. 59 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. 60 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. 61 Recommended reading • Books – Hernan, M. A. and J. Robins. Causal Inference. Web: – Rothman, K. J., S. Greenland, and T. L. Lash. Modern Epidemiology. 2008. – 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 – 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. 62 References • Chen, L., et al. "Alcohol intake and blood pressure: a systematic review implementing a Mendelian randomization approach." PLoS Med 2008 • Greenland, S. and B. Brumback. "An overview of relations among causal modelling methods." Int J Epidemiol 2002 • Hernan, M. A., S. Hernandez-Diaz, and J. M. Robins. "A structural approach to selection bias." Epidemiology 2004 • Hernan, M. A. and S. R. Cole. "Causal diagrams and measurement bias." Am J Epidemiol 2009 • Sheehan, N. A., et al. "Mendelian randomisation and causal inference in observational epidemiology." PLoS Med 2008 • VanderWeele, T. J. and J. M. Robins. "Directed acyclic graphs, sufficient causes, and the properties of conditioning on a common effect." Am J Epidemiol 2007 • VanderWeele, T. J., M. A. Hernan, and J. M. Robins. "Causal directed acyclic graphs and the direction of unmeasured confounding bias." Epidemiology 2008 • VanderWeele, T. J. "The sign of the bias of unmeasured confounding." Biometrics 2008 May-16 H.S. 63 Exercise: Collider stratification H Hospital risk: D E 1 0 1 0 0.6 0.3 0.2 0.1 Response= 16 % E 0 1 0 sum 36 164 64 736 100 900 1000 May-16 E 3.0 E Hospital D Population D 1 2.0 1 0 D 2.0 No hospital D 1 0 sum 22 49 13 74 35 123 157 H.S. E 1 0 1 0 sum 15 115 51 663 65 777 843 64 Exercise: Collider stratification • Selection: 1. Confirm that exposure doubles the risk of hospitalization (hint RREH=0.6/0.3=2) 2. Confirm that disease triples the risk of hospitalization 3. Confirm (roughly) that the hospital 2*2 table is correct (hint 35*0.6=22,…) • Relative risk of exposure on disease: 4. What is the RR (of E on D) in the hospital group? 5. What is the RR (of E on D) in the non-hospital group? 6. Are the RRs biased? 10 minutes May-16 H.S. 65