Skip to main content

Find a generalized backdoor set

Source: R/identification.R

Description

Returns a generalized back-door set relative to (x, y) in cg using the Generalized Backdoor Criterion (GBC), or NULL if none exists.

Usage

backdoor_set(cg, x, y, include = character(), restrict = NULL)

Arguments

cg A DAG, CPDAG, ADMG, MAG, or PAG graph created with cgraph().
x, y Exposure and outcome node names.
include Character vector of nodes forced into the set (DAG and ADMG only).
restrict Character vector of candidate nodes the set is drawn from (DAG and ADMG only). NULL (default) allows every node except x and y.

Value

Character vector with a generalized back-door set, or NULL if none exists.

References

Maathuis MH, Colombo D (2015). “A generalized back-door criterion.” The Annals of Statistics, 43(3), 1060–1088.

Examples

# A --> X <-- C protects both edges into X
cpdag <- cgraph(A %-->% X, C %-->% X, X %-->% Y, class = "CPDAG")
sort(backdoor_set(cpdag, "X", "Y"))
#> [1] "A" "C"