Learn R Programming

dagR (version 1.1.1)

dag.init: Set up a new DAG.

Description

Allows setting up a new DAG. See the demo.dag0 to demo.dag6 functions for some example specifications.

Usage

dag.init(outcome = NULL, exposure = NULL, covs = c(), arcs = c(),
 assocs = c(), xgap = 0.04, ygap = 0.05, len = 0.1, y.name = NULL,
 x.name = NULL, cov.names = c(), ...)

Arguments

outcome
Currently not used!
exposure
Currently not used!
covs
Vector including an integer for each covariable to be in the DAG (1 for a "standard" covariable, 2 for an unknown/unmeasured one).
arcs
Vector of duplets of integers, in which nodes from which an arc or undirected association is to emenate are followed by those to which it is to point. To refer to the exposure, use 0, to refer to the outcome, use -1, to refer to covariables, use and eleme
assocs
A vector of same length as covs, with 0 indicating directed arcs, 1 indicating undirected associations.
xgap
How much x space is to be left between arc ends and nodes when drawing?
ygap
How much y space is to be left between arc ends and nodes when drawing?
len
Length of arrow whiskers when drawing.
y.name
Label of outcome.
x.name
Label of exposure.
cov.names
Vector of covariable labels.
...
Currently not used.

Value

  • A DAG (objects of class dagRdag). Check out some of the demonstration DAGs for details. The DAG is actually a list object, with elements cov.types (the covs vector, with 0 put in front, and -1 at the end).; x and y (coordinates for drawing the nodes, initially set up more or less in a half-circle above the x->y arc); arc (the arcs, transformed into a matrix); arc.type (the assocs vector); curve.x and curve.y (if associations are featured, these provide the coordinates through which to curve); xgap, ygap, len (the respective drawing parameters); version (dagR version).

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.

See Also

dag.draw

Examples

Run this code
demo.dag1;
demo.dag1();
demo.dag2;
demo.dag2();

Run the code above in your browser using DataLab