Skip to contents

This function creates a DAG using the DiagrammeR package. It allows for the inclusion of various biases and paths.

Usage

create_dag(
  exposure_name,
  outcome_name,
  label_inquiry = "Causal Inquiry",
  confounder_path = NULL,
  surrogate_confounder = NULL,
  collider_path = NULL,
  notoriety_bias = NULL,
  drug_competition_bias = NULL,
  event_competition_bias = NULL,
  background_dilution = NULL,
  add_measurements = FALSE,
  add_reporting = FALSE,
  ascertainment_drug = NA,
  ascertainment_event = NA,
  additional_rows = "",
  rankdir = "LR",
  scenario = "inquiry"
)

Arguments

exposure_name

Character. The name of the exposure variable.

outcome_name

Character. The name of the outcome variable.

label_inquiry

Character. The label for the inquiry. Default is "Causal Inquiry".

confounder_path

List. A list containing nodes and signs (and potentially direction) for the confounder path. By deafault it does not show it.

surrogate_confounder

List. A list containing the surrogate confounder and its root. By deafault it does not show it.

collider_path

List. A list containing nodes and signs for the collider path. By deafault it does not show it.

notoriety_bias

Character. The notoriety bias variable. By deafault it does not show it.

drug_competition_bias

Character. The drug competition bias variable. By deafault it does not show it.

event_competition_bias

Character. The event competition bias variable. By deafault it does not show it.

background_dilution

List. A list containing the drug and event for background dilution. By deafault it does not show it.

add_measurements

Logical. Whether to add measurements. Default is FALSE.

add_reporting

Logical. Whether to add reporting Default is FALSE.

ascertainment_drug

Character. Whether to draw an ascertainment bias introduced by the drug. Default is NA.

ascertainment_event

Character. Whether to draw an ascertainment bias introduced by the event. Default is NA.

additional_rows

Character. Parameter to add more lines for customised DAGs.

rankdir

Character. The direction of the graph layout. Default is "LR", or left to right. It can also be set "TB" or top to bottom.

scenario

Character. The causal scenario type. Default is "inquiry", leaving the question mark on the relation between drug and event. It can also be causal and non-causal.

Value

A DAG created using the DiagrammeR package.

Examples

create_dag("Exposure", "Outcome")