The textual syntax for DAGitty graph is based on the dot language of the
graphviz software (https://graphviz.gitlab.io/_pages/doc/info/lang.html). This is a
fairly intuitive syntax -- use the examples below and in the other functions to
get you started. An important difference to graphviz is that the DAGitty language
supports several types of graphs, which have different semantics. However, many users
will mainly focus on DAGs.
A DAGitty graph description has the following form:
[graph type] '{' [statements] '}'
where [graph type]
is one of 'dag', 'mag', 'pdag', or 'pag' and [statements]
is a list of variables statements and edge statements, which may (optionally) be
separated by semicolons. Whitespace, including newlines, has no semantic role.
Variable statments look like
[variable id] '[' [properties] ']'
For example, the statement
x [exposure,pos="1,0"]
declares a variable with ID x that is an exposure variable and has a layout position
of 1,0.
The edge statement
x -> y
declares a directed edge from variable x to variable y. Explicit variable statements
are not required for the variables involved in edge statements, unless attributes
such as position or exposure/outcome status need to be set.
DAGs (directed acyclic graphs) can contain the following edges: ->
, <->
.
Bidirected edges in DAGs are simply shorthands for substructures <- U ->
,
where U is an unobserved variable.
MAGs (maximal ancestral graphs) can contain the following edges: ->
,
<->
, --
.
The bidirected and directed edges of MAGs can represent latent confounders, and
the undirected edges represent latent selection variables.
For details, see Richardson and Spirtes (2002).
PDAGs (partially directed acyclic graphs) can contain the following edges: ->
,
<->
, --
.
The bidirected edges mean the same thing as in DAGs. The undirected edges represent
edges whose direction is not known. Thus, PDAGs are used to represent equivalence
classes of DAGs (see also the function equivalenceClass
).
PAGs (partial ancestral graphs) are to MAGs what PDAGs are to DAGs: they represent
equivalence classes of MAGs. MAGs can contain the following edges: @-@
,
->
, @->
, --
, @--
(the @ symbols are written as circle marks in most of the literature). For
details on PAGs, see Zhang et al (2008). For now, only a few DAGitty functions
support PAGs (for instance, adjustmentSets
.
The DAGitty parser does not perform semantic validation. That is,
it will not check whether a DAG is actually acyclic, or whether all chain components
in a PAG are actually chordal. This is not done because it can be computationally
rather expensive.