Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

dagR-package

R functions for directed acyclic graphs


Description

The package dagR contains a couple of functions to draw, manipulate and evaluate directed acyclic graphs (DAG), with a focus on epidemiologic applications, namely the assessment of adjustment sets and potentially biasing paths. The functions for finding and evaluating paths essentially implement the graphical algorithms outlined in Greenland (1999).

When using this package for your work, please cite Breitling (2010).

Note: As spelled out in the license, this suite of functions comes without any warranty, and cautious use is strongly advised. Although testing was carried out as meticulously as possible, it must be expected that bugs or errors remain, in particular in the early versions of the package. Please report any problems, concerns, but also suggestions for improvements or extensions to the author.

Important additions in future versions could be e.g. improved drawing routines with better formatting of alternative node symbols in the DAG (taking into account the string length) and algorithms with intelligent/efficient search for minimal adjustment sets.

Details

Package: dagR
Type: Package
Version: 1.2.0
Date: 2021-04-17
License: GPL-2
LazyLoad: yes

dag.init is used for setting up DAGs. See the code of the functions demo.dag0 to demo.dag6 for example code. To adjust and/or evalute DAGs for biasing paths, use dag.adjust, dag.draw for drawing a DAG. dag.search uses brute.search to evaluate all possible adjustment sets, allowing the identification of minimal sufficient adjustment sets using msas. dag.sim simulates data (normally distributed or binary) according to the causal structure given by a DAG object.
In version 1.2.0, generic S3 methods (print, plot, summary) for dagR-DAGs were implemented, but the original functions summary_dagRdag to summarize and dag.draw to plot a DAG object were preserved for backwards compatibility. Export functions to other packages were added upon a reviewer request.
Several helper functions currently are not hidden and should later be made internal.

Please see the NEWS file for version changes and known open issues.

Author(s)

Lutz P Breitling <l.breitling@posteo.de>

References

Breitling LP (2010). dagR: a suite of R functions for directed acyclic graphs. Epidemiology 21(4):586-587.
Greenland S, Pearl J, Robins JM (1999). Causal diagrams for epidemiologic research. Epidemiology 10(1):37-48.

Examples

dag1<-demo.dag1();
plot(dag1);
dag1a<-dag.adjust(dag1, 3);
plot(dag1a);
dag1s<-dag.search(dag1);
summary(dag1);
summary(dag1a);
summary(dag1s);

dagR

R Functions for Directed Acyclic Graphs

v1.2.0
GPL-2
Authors
Lutz P Breitling
Initial release
2021-04-17

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.