r-causal/ggdag

:arrow_lower_left: :arrow_lower_right: An R package for working with causal directed acyclic graphs (DAGs)

What it solves

It simplifies the process of creating, analyzing, and visualizing causal directed acyclic graphs (DAGs) within the R programming environment, specifically integrating these tasks with the tidyverse ecosystem.

How it works

The package acts as a bridge between dagitty (used for creating and analyzing structural causal models) and ggplot2/ggraph (used for plotting). It allows users to define DAGs using a specialized R-like syntax via dagify or by tidying existing dagitty objects into a format that is easy to manipulate and plot using standard ggplot2 geoms.

Who it’s for

Researchers and data scientists using R who need to model causal relationships and visualize the structural bias or adjustment sets in their causal models.

Highlights

  • Tidy Integration: Converts complex causal models into tidy data frames for easy plotting.
  • R-like Syntax: Provides the dagify function to define causal relationships using familiar formula notation.
  • Causal Analysis: Includes tools to identify adjustment sets and analyze d-separation/d-connection.
  • Built-in Bias Templates: Offers quick functions to visualize common structures of bias, such as butterfly bias and confounder triangles.

Related

  • Project
  • Project
  • Project
  • Project
  • Project