scc_to_dag: Transform SCC to DAG

View source: R/dag.R

scc_to_dagR Documentation

Transform SCC to DAG

Description

Creates an object of class dagitty (dagitty package) from a SCC model, following VanderWeele and Robins (2007).

Usage

scc_to_dag(scc, unknown = TRUE)

Arguments

scc

An object of class epicmodel_scc.

unknown

TRUE (default) or FALSE. If TRUE, unknown causes are added to the SCC model: every sufficient cause gets an additional individual unknown component cause representing additional unknown components; an unknown sufficient cause is added to the model consisting of a single unknown component cause and representing all unknown sufficient causes.

Value

A list of length 2 containing an object of class dagitty (named dag) and a data.frame containing the information, which label in the DAG corresponds to which component cause (named legend).

References

VanderWeele TJ, Robins JM (2007): Directed acyclic graphs, sufficient causes, and the properties of conditioning on a common effect. American Journal of Epidemiology 166 (9): 1096–1104.

See Also

  • dagitty::dagitty()

  • SCC models for more information on unknown causes and SCC models in general

  • plot_dag() to create a ggplot object from dagitty model code

Examples

# Create some SCC model
steplist_checked <- check_steplist(steplist_rain)
scc_model <- create_scc(steplist_checked)

# Transform it into a DAG
scc_to_dag(scc_model)

epicmodel documentation built on April 12, 2025, 1:59 a.m.