Skip to content

GerkeLab/shinyDAG

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

shinyDAG

shinyDAG is a web application that uses R and LaTeX to create publication-quality images of directed acyclic graphs (DAGs). Additionally, the application leverages complementary R packages to evaluate correlational structures and identify appropriate adjustment sets for estimating causal effects1-4. The web-based application can be accessed at https://apps.gerkelab.com/shinyDAG/.

Key operations

Adding nodes and edges

Alt Text

Editing DAG aesthetics

Alt Text

Examplary usage

The following DAG was reproduced from "A structural approach to selection bias"5 (Figure 6A) using the shinyDAG web app.

alt text

For comparison, the DAG from the original article is shown below.

alt text

The DAG represents a study on the effects of antiretroviral therapy (E) on AIDS risk (D), where immunosuppression (U) is unmeasured. L represents presence of symptoms (such as fever, weight loss, and diarrhea) and C represents censoring. A spurious path exists between E and D due to selection bias. We can see this in shinyDAG by ensuring that we've selected E as the exposure, D as the outcome, adjusted for C, and then toggling the "Examine DAG elements" button in the bottom left corner. The spurious open path is displayed as D <- U -> L -> C <- E.

alt text

One possible resolution for this bias is to adjust for L. After toggling L in the "Select nodes to adjust" section, we see that all spurious E to D paths are now closed.

alt text

Other features

In addition PDF and PNG exports, users can download R objects in ggdag or daggity formats, as well as the source LaTeX code. The "Edit LaTeX" pane permits in-app modification of the LaTeX code with a preview window; however, users should be aware that the information in "Examine DAG elements" is not responsive to changes in the Edit LaTeX pane.

shinyDAG should work in most modern web browsers, however, we have observed optimal performance in Chrome. The most notable difference across OS/browsers is likely to be in display handling for the PDF preview in the main panel: various user or browser-specific settings will determine the default zoom level.

Citing shinyDAG

shinyDAG was developed by Jordan Creed, Garrick Aden-Buie and Travis Gerke.

Concept DOI: 10.5281/zenodo.1288712

v0.1.0 DOI: 10.5281/zenodo.1296477

v0.0.0 DOI: 10.5281/zenodo.1288713

References

  1. Richard Iannone (NA). DiagrammeR: Graph/Network Visualization. R package version 1.0.0. https://github.com/rich-iannone/DiagrammeR.
  2. Johannes Textor and Benito van der Zander (2016). dagitty: Graphical Analysis of Structural Causal Models. R package version 0.2-2. https://CRAN.R-project.org/package=dagitty.
  3. Malcolm Barrett (2018). ggdag: Analyze and Create Elegant Directed Acyclic Graphs. R package version 0.1.0. https://CRAN.R-project.org/package=ggdag.
  4. Csardi G, Nepusz T: The igraph software package for complex network research, InterJournal, Complex Systems 1695. 2006. http://igraph.org.
  5. Hernan MA, Hernandez-Díaz S, Robins JM. A structural approach to selection bias. Epidemiology 2004;15:615-625.