dag.init: Set up a new DAG.

dag.initR Documentation

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(), symbols = NULL, ...)

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 element of 1:length(covs).

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.

symbols

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.

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); symbols (alternative node symbols); version (dagR version).

Note

CAVE: The numbering of the covariables and arc coordinates is different here than in the functions later used on the DAG (e.g. add.arc, dag.adjust)! The functions generally work according to the indexing of the R objects that they handle. Whereas for dag.init the n covariable nodes are numbered 1:n, the node vector of the resulting DAG will also contain the exposure node at the beginning and the outcome node at the end, i.e. it will go from 1:(n+2) with the covariables at 2:n+1. summary_dagRdag will show the latter numbering. Example: when adjusting for the first covariable, dag.adjust must be handed the adjustment set A=2, as the first covariable will occupy the second node (the first node is occupied by the exposure).

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.

See Also

dag.draw

Examples

#dag.init(covs = c(1, 1), arcs = c(0, 2, 1, 2, 1, 0, -1, 2))

dagR documentation built on Oct. 9, 2022, 5:06 p.m.