Download presentation
Presentation is loading. Please wait.
Published byCrystal Hunter Modified over 6 years ago
1
To get ready for class: 1. Get births ready as usual
2. Install package dagitty
2
DAGs EPID 799C Fall 2017
3
Overview Quick note on table() / prop.table() / EMM from last class
Overview of DAGs DAGs in R
4
On prop.table()… # Thinking ahead to EMM pt2 = prop.table(table(births$pnc5_f, births$preterm_f, births$raceeth_f), margin = c(1,3)) #risks. Note we're getting into dplyr is better territory... pt2[2,1,]-pt2[1,1,] #Crude RDs pt2[1,2,] # term births, no PNC pt2_df = data.frame(pt2) names(pt2_df) = c("exposure", "outcome", "group", "estimate") ggplot(data=pt2_df[pt2_df$outcome == "preterm",], aes(x=exposure, y=estimate, color=group, group=group))+ geom_point()+geom_path()+ labs(title="Quick look at Crude EMM of RD by Race-Ethnicity", x= "Prevalence of Preterm Birth", subtitle="Note possible EMM in the angle of the lines... \n ...and disparities more impactful than our intervention. ")
5
…we’ll improve this with some dplyr, but just from a quick table and ggplot…
6
What is a DAG? DAGs (Directed Acyclic Graphs) document causal assumptions / knowledge from our head or literature. They can be used to guide us to better answer questions like: Does a change in A prompt a change in B? Or the other way around? Or not in either direction, but their association is caused by some third thing?
7
DAG Requirements Directed: , not -- Acyclic: AB, not AB and BA
Graph: Connected, not dangling*. Other disciplines, from engineering to other forms of statistical model, relax these requirements.
8
Overview Directed: , not -- Acyclic: AB, not AB and BA
Graph: Connected, not dangling*.
9
Mediation
10
Confounders
11
Colliders Inducing a biased causal association through controlling a collider is: collider stratification bias
12
Effect Measure Modifiers
13
EMM: Two notes Note that an EMM may or may not be a confounder (influencing the values of A and B directly, vs. the effect of A on B), so may not be in the DAG node network. EMMs are good for a DAG notes though! Also note that it may be rare that an exposure / intervention switches direction entirely. Effect measure modification worth acknowledging may be a matter of degree… or important to report because of context - regardless of statistical interaction, p=whatever.
14
In Sum: Create a model, throw things in, reduce by p-value / backwards selection, or any of a number of techniques. May be good at predicting outcome from exposure and other variables. There is nuance here, but…
15
In Sum: …if we want the causal effect, we have to be intentional about what parts of this flow we block. We leave direct and indirect causal paths, and leave blocked paths with colliders (do not control!)
16
How do we do this? Encode the nodes and directed edges of the DAG from the literature / content knowledge By eye, hand, or software document all paths between Exposure and Outcome Identify whether they are already blocked (collider), backdoor (confounded), or causal (direct or indirect through a mediator) Select nodes to statistically control, often ideally as few as possible, to block the open backdoor paths without blocking
17
DAG critiques Reality isn’t DAGGY Not all nodes / edges are alike
DAGs (even if large) are a model, and so a simplified version of reality, in this particular case requiring unidirectionality and acyclic assumptions. Reality is often a system with feedback loops and inter-relationships that may not be modeled well with unidirectional models, perhaps especially with social / network processes. There are other methods! Not all nodes / edges are alike Race-ethnicity in particular is a heavily overloaded construct, reaching back to represent historical and current systemic oppression and racism, physical phenotype, experiences of cultural and ascribed identity. Parts of this construct may have different causal relationships. Break apart if you can, and regardless, be mindful / nuanced in your interpretation. Not always interested in causal effects Prediction, association, other techniques have a place in a public health toolbox. VanderWeele, Tyler J., and Whitney R. Robinson. “On the Causal Interpretation of Race in Regressions Adjusting for Confounding and Mediating Variables:” Epidemiology 25, no. 4 (July 2014): 473–84. doi: /EDE
18
Our (toy) DAG Directed Acyclic Graphs (DAGs) inform our variable selection and treatment in models (based on their status as mediators, confounders, effect measure modifiers, etc. We will not elaborate in this class! Take the Epi sequence for more DAG from EPID 716 / Christy Avery
19
Let’s Try: Dagitty Check it out here: www.dagitty.net
Premade DAG for you: dagitty.net/moAh6a6
20
DAGs in R Dagitty ( exports R code for the dagitty package DL the R script from the website: DAGs.zip
21
Let’s Try: DAGs in R dagitty() : makes DAGs
adjustmentSets() : minimal / all adjustment sets paths() : paths! children(), etc. downloadGraph – design in dagitty, pull down in R instrumentalVariables(), SEM stuff, testing your data against a DAG, etc. Currently beyond me!
22
Practical Uses R may be helpful for quickly changing and rerunning for minimal sets a few different DAG scenarios. Probably better than hand. Nice pair with dagitty website. Maybe useful for SEM? I dunno. But you can stick your DAGs in papers / R Markdown, make ggplots of them, etc.
23
Other Packages If you do this a lot, find your favorite! R skills let you translate data structures across packages as you need to. dagitty: Today! DiagrammeR: Prettier, but no adjustment sets? dagR: Prettier and adjustment sets, but funny syntax? static.s3.amazonaws.com/2609_e3d86d0748c04eb18d5f 56d6a99feb3f.html
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.