Learn R Programming

DAGassist (version 0.2.7)

classify_nodes: Classify DAG nodes

Description

Labels each node by causal role in a console tabular grid. This function is mostly used as an internal helper, but can be used on its own. Users are encouraged to alternatively use DAGassist::DAGassist(show=roles) for role table specific output.

Usage

classify_nodes(dag, exposure, outcome)

Value

A data.frame with one row per node and columns:

  • variable (node name)

  • logical flags: is_exposure, is_outcome, is_confounder, is_mediator, is_collider, is_neutral_on_treatment, is_neutral_on_outcome, is_descendant_of_mediator, is_descendant_of_collider, is_descendant_of_confounder_on_bdp, is_descendant_of_confounder_off_bdp

  • role (a single primary label)

Arguments

dag

A dagitty DAG object.

exposure

Optional-- inferred from DAG if not set; character; exposure node name (Exp.).

outcome

Optional-- inferred from DAG if not set; character; outcome node name (Out.).

Examples

Run this code
  d1 <- dagitty::dagitty("dag {X[exposure];Y[outcome] Z -> X; Z -> Y; X -> Y }") 
  classify_nodes(d1)
  

Run the code above in your browser using DataLab