Allows setting up a new DAG.
See the demo.dag0
to demo.dag6
functions for some example specifications.
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(), symbols = NULL, ...)
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);
symbols
(alternative node symbols);
version
(dagR version).
Currently not used!
Currently not used!
Vector including an integer for each covariable to be in the DAG (1 for a "standard" covariable, 2 for an unknown/unmeasured one).
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 element of 1:length(covs).
A vector of same length as covs, with 0 indicating directed arcs, 1 indicating undirected associations.
How much x space is to be left between arc ends and nodes when drawing?
How much y space is to be left between arc ends and nodes when drawing?
Length of arrow whiskers when drawing.
Label of outcome.
Label of exposure.
Vector of covariable labels.
Vector of alternative node symbols. Longer symbols will not be formatted nicely. Note that the first element refers to the exposure, the following ones to the covariables, the last one to the outcome.
Currently not used.
Lutz P Breitling <l.breitling@posteo.de>
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.
dag.draw
#dag.init(covs = c(1, 1), arcs = c(0, 2, 1, 2, 1, 0, -1, 2))
Run the code above in your browser using DataLab