dagR-package {dagR}R Documentation

R functions for directed acyclic graphs

Description

The package dagR (pronounce "dagger") 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.1.3
Date: 2014-01-08
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 (Breitling (submitted)). At present, summary_dagRdag can summarize a DAG object. This should later become an S3 method.
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 <lutz.breitling@gmail.com>

References

Breitling LP (2010). dagR: a suite of R functions for directed acyclic graphs. Epidemiology 21(4):586-587.
Breitling LP (submitted). Understanding confounding and data analytical strategies through DAG-based data simulations.
Greenland S, Pearl J, Robins JM (1999). Causal diagrams for epidemiologic research. Epidemiology 10(1):37-48.

Examples

dag1<-demo.dag1();
dag.draw(dag1);
dag1a<-dag.adjust(dag1, 3);
dag.draw(dag1a);
dag1s<-dag.search(dag1);
summary_dagRdag(dag1);
summary_dagRdag(dag1a);
summary_dagRdag(dag1s);

[Package dagR version 1.1.3 Index]