Skip to content

Latest commit

 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

reduceDAG

Reduced DAG and g-formula for efficient estimation of average causal effects

Directed acyclic graphs (DAGs) are widely used to represent structural assumptions for causal inference. Given a causal DAG, for estimating the effect of treatment A on outcome Y, the counterfactual mean of Y(a) can be identified by the well-known g-formula (Robins, 1986). However, perhaps surprisingly, not every variable that appears in the DAG (or the g-formula) carries information for estimating the counterfactual mean (or the effect).

reduceDAG is an R package that identifies all the uninformative variables from a DAG. Further, by projecting out these variables, it returns a reduced DAG that encapsulates information required for identifying and optimally estimating an average causal effect (of a point intervention). Accordingly, a reduced g-formula is derived from the reduced graph.

Installation

The package can be installed from GitHub.

# install.packages("devtools")
devtools::install_github("richardkwo/reduceDAG", build_vignettes = TRUE)

For a quick start, check out the vignette:

vignette("reduceDAG")

Example

library(dagitty)  # http://www.dagitty.net/
library(reduceDAG)
g <- dagitty('dag {
    A [pos="0,2", exposure]
    M [pos="1,1"]
    Y [pos="2,2", outcome]
    O [pos="1,0"]
    A -> M -> Y
    A -> Y
    O -> M
}')

plot(g)
cat(gFormula(g))
# ∑_{M,Y} Y P[Y | A=a,M] ∑_{O} P(M | A=a,O) P(O)

h <- reduceDAG(g, verbose=TRUE)
# Uninformative variables {M} are eliminated.
# Reduced g-formula:
# ∑_{O,Y} Y P[Y | A=a,O] P(O) 

Reference

Guo, F. Richard, Emilija Perković and Andrea Rotnitzky. "Variable elimination, graph reduction and efficient g-formula" (2022, working paper).

About

Reduced DAG and g-formula for estimating the average causal effect

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages