Skip to content

wilswer/dsep

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

54 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DSEP: A D-Separation Analysis Tool

Confounder example

Overview

DSEP is a command-line tool written in Rust for analyzing causal graphs using d-separation — a graphical criterion for determining conditional independence in Directed Acyclic Graphs (DAGs). It is aimed at researchers, epidemiologists, and statisticians who work with causal diagrams and need to identify confounding paths, validate adjustment sets, or find minimal separating sets between variables.


What It Does

Given a causal DAG specification (e.g., a->b->c or exposure<-confounder->outcome), DSEP can:

  • Parse and construct a causal DAG from a concise arrow notation (->, <-)
  • Classify nodes as Exposure (input), Outcome, Adjustment, or Unknown
  • Validate adjustment sets: check whether a given set of conditioning variables d-separates the exposure from the outcome
  • Find minimal d-separating sets: identify the smallest set of variables that blocks all paths between two nodes
  • Visualize the DAG as a color-coded SVG diagram
  • Read DAG definitions from command-line arguments, files, or standard input

Example Usage

# Check if {Z} d-separates X and Y in X -> Z -> Y
dsep "X->Z->Y" -e X -o Y -a Z --check-adjustment

# Find a minimal d-separator
dsep "X->Z->Y" -e X -o Y --min-d-separation

# Generate an SVG visualization
dsep "X->Z->Y" --svg-file-name diagram.svg

Installation

Clone the repository and cd into it:

git clone https://github.com/wilswer/dsep.git && cd dsep

Install using cargo:

cargo install --path .

About

DSEP is a command-line tool for analyzing causal graphs using d-separation.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages